Explore topic-wise MCQs in Mysql.

This section includes 92 Mcqs, each offering curated multiple-choice questions to sharpen your Mysql knowledge and support exam preparation. Choose a topic below to get started.

1.

What will be the result of the following query?
WHERE TITLE= teller  OR start_date= 2008-02-02 

A. The employee is something other than a teller but was employed prior to 2008
B. The employee is a teller and was employed prior to 2008
C. The employee is a teller and was employed after February 2, 2008
D. All of above
E. None of these
Answer» E. None of these
2.

What will be the result of the following query?
WHERE TITLE=  teller  AND start_date <  2007-01-01 

A. Only tellers who began working for the bank prior to 2007 will not be included
B. Only tellers who began working for the bank prior to 2007 will be included
C. Any employee who is either not a teller or began working for the bank in 2007 or later will be removed from consideration
D. All of above
E. None of these
Answer» C. Any employee who is either not a teller or began working for the bank in 2007 or later will be removed from consideration
3.

The following query belongs to which condition types?
SELECT firstname
FROM Employee
WHERE fed_id= 333-33-333 ;

A. Inequality condition
B. Range condition
C. Equality condition
D. All of above
E. None of these
Answer» D. All of above
4.

The following query belongs to which condition types?
SELECT firstname
FROM Employee
WHERE title= Engineer ;

A. Range condition
B. Equality condition
C. Inequality condition
D. All of above
E. None of these
Answer» C. Inequality condition
5.

Does the following query belong to the Inequality condition ?
SELECT product_type.name, product.name
FROM product_type INNER JOIN Product
ON product_type.dept=Product.dept
WHERE product_type.name<> customers_accounts ;

A. Depends
B. No
C. Yes
D. All of above
E. None of these
Answer» D. All of above
6.

Is the following query belongs to the Equality condition ?
SELECT product_type.name, product.name
FROM product_type INNER JOIN Product
ON product_type.dept=Product.dept
WHERE product_type.name= customers_accounts ;

A. No
B. Depends
C. Yes
D. All of above
E. None of these
Answer» D. All of above
7.

What will be the output of the following query?
SELECT *
FROM Student
WHERE start_date BETWEEN 2009-05-05 AND 2010-05-05 ;

A. All Student details from 2009 to 2010
B. All Student details between 2009 and 2010
C. All Student details before 2009
D. All of above
E. None of these
Answer» C. All Student details before 2009
8.

What will be the output of the following query?
SELECT accountid, productid, custid
FROM account
WHERE productid IN ( sav , chd , mm );

A. Only those values are selected whose productid is either sav
B. Only those values are selected whose productid is either sav , chd
C. Only those values are selected whose productid is either sav , chd , mm
D. All of above
E. None of these
Answer» D. All of above
9.

Find the error in the following query?
SELECT custid, fedid
FROM customer
WHERE custid = I
AND fedid BETWEEN 6000-00-000 AND 8888-888-000;

A. No
B. Range too high to compare
C. Yes
D. All of above
E. None of these
Answer» B. Range too high to compare
10.

Consider a database name interviewmania whose attributes are intern_id (primary key), subject.
Internid = {1, 2, 3, 4, 5, 6}
Subject = {sql, oop, sql, oop, c, c++}
If these are one to one relation then what will be the output of the following query?
SELECT internid
FROM interviewmania
WHERE subject IN (c, c++, oop);

A. {2, 4, 5, 6}
B. {3, 4}
C. {1, 2, 3}
D. {5, 6}
E. None of these
Answer» B. {3, 4}
11.

What will be the output of the following query?
SELECT stu_id, first_name, last_name
FROM student
WHERE LEFT (first_name, 1) = F OR LEFT (last_name, 1) = F ;

A. Only those student are selected whose first name and last name started with any other letter except F
B. Only those student are selected whose first name and last name started with F
C. Only those student are selected whose first name started with F but last name can be starts with any other letter
D. All of above
E. None of these
Answer» C. Only those student are selected whose first name started with F but last name can be starts with any other letter
12.

Consider a database name interviewmania whose attributes are internid (primary key), subject.
Internid = {1, 2, 3, 4, 5, 6}
Subject = {sql, oop, sql, oop, c, c++}
If these are one to one relation then what will be the output of the following query?
SELECT internid
FROM interviewmania
WHERE subject NOT IN (c, c++, oop);

A. {1, 4}
B. {3, 4}
C. {1, 2, 3}
D. {5, 6}
E. None of these
Answer» B. {3, 4}
13.

Consider a database name interviewmania whose attributes are internid (primary key), subject, subjectvalue.
Internid = {1, 2, 3, 4, 5, 6}
Subject = {sql, oop, sql, oop, c, c++}
Subjectvalue = {0, 0, 1, 1, 2, 2, 3, 3}
If these are one to one relation then what will be the output of the following query?
SELECT internid
FROM interviewmania
WHERE subject IN (SELECT subject FROM interviewmania WHERE subjectvalue IN (3, 2));

A. {1, 2, 3, 4, 5, 6}
B. {3, 4}
C. {1, 2, 3}
D. {5, 6}
E. None of these
Answer» B. {3, 4}
14.

What will be the output of the following query?
SELECT stu_id, first_name, last_name
FROM student
WHERE LEFT (first_name, 1) = F ;

A. Only those student are selected whose first name started with other than F
B. Only those student are selected
C. Only those student are selected whose first name started with F
D. All of above
E. None of these
Answer» D. All of above
15.

What will be the output of the following query?
SELECT stu_id, first_name, last_name
FROM student
WHERE LEFT (last_name, 1) = F ;

A. Only those student are selected whose last name started with other than F
B. Only those student are selected whose last name started with F
C. Only those student are selected
D. All of above
E. None of these
Answer» C. Only those student are selected
16.

What will be the output of the following query?
SELECT stu_id, first_name, last_name
FROM student
WHERE LEFT (last_name, 1) = T ;

A. Only those student are selected whose last name started with other than T
B. Only those student are selected
C. Only those student are selected whose last name started with T
D. All of above
E. None of these
Answer» D. All of above
17.

What will be the output of the following query?
SELECT *
FROM student
WHERE last_name LIKE %t%f%n%;

A. All student whose last name contains f in fourth position
B. All student whose last name contains n in second last position
C. All student whose last name contain t in second position
D. All of above
E. None of these
Answer» E. None of these
18.

What will be the output of the following query?
SELECT *
FROM student
WHERE last_name LIKE %bas% OR first_name LIKE %bbs%;

A. All student whose last name should contain substring bas or first name should contain substring bbs
B. All student whose last name should contain substring bas
C. All student whose first name should contain substring bbs
D. All of above
E. None of these
Answer» B. All student whose last name should contain substring bas
19.

What will be the output of the following query?
SELECT *
FROM student
WHERE last_name LIKE F% AND last_name LIKE %T ;

A. All student whose last name start with T and end with F
B. All student whose last name should started with F and end with F
C. All student whose last name should started with F and end with T
D. All of above
E. None of these
Answer» D. All of above
20.

What will be the output of the following query?
SELECT *
FROM student
WHERE last_name LIKE F% OR last_name LIKE %T ;

A. All student whose last name should started with F and end with T
B. All student whose last name should started with F
C. All student whose last name end with T
D. All of above
E. None of these
Answer» B. All student whose last name should started with F
21.

What will be the output of the following query?
SELECT *
FROM student
WHERE last_name LIKE _a%e% ;

A. All student whose last name start with any letter but contain at least one e in his name
B. All student whose last name should have letter a in second position and at least one e in his name
C. All student whose last name start with any letter but second letter should be a
D. All of above
E. None of these
Answer» E. None of these
22.

Consider a database name interveiwmania whose attributes are internid (primary key), subject, subjectvalue.
Internid = {1, 2, 3, 4, 5, 6}
Subject = {sql, oop, sql, oop, c, c++}
Subjectvalue = {0, 0, 1, 1, 2, 2, 3, 3}
If these are one to one relation then what will be the output of the following query?
SELECT internid
FROM interveiwmania
WHERE subject IN (SELECT subject FROM interveiwmania WHERE subjectvalue = 3);

A. {1, 2, 3}
B. {3, 4}
C. {5, 6}
D. All of above
E. None of these
Answer» D. All of above
23.

Consider a database name interviewmania whose attributes are internid (primary key), subject.
Internid= {1, 2, 3, 4, 5, 6}
Subject= {sql, oop, sql, oop, c, c++}
If these are one to one relation then what will be the output of the following query?
SELECT internid
FROM interviewmania
WHERE subject NOT IN (c, c++);

A. {1, 2, 3}
B. {3, 4}
C. {5, 6}
D. All of above
E. None of these
Answer» F.
24.

Consider a database name interviewmania whose attributes are internid (primary key), subject.
Internid = {1, 2, 3, 4, 5, 6}
Subject = {sql, oop, sql, oop, c, c++}
If these are one to one relation then what will be the output of the following query?
SELECT internid
FROM interviewmania
WHERE subject IN (c, c++, oop, SQL);

A. Empty set
B. {5, 6}
C. {3, 4}
D. {1, 2, 3}
E. None of these
Answer» B. {5, 6}
25.

Consider a database name interviewmania whose attributes are internid (primary key), subject.
Internid = {1, 2, 3, 4, 5, 6}
Subject = {sql, oop, sql, oop, c, c++}
If these are one to one relation then what will be the output of the following query?
SELECT intern_id
FROM interviewmania
WHERE subject IN (c, c++);

A. {1, 2, 3}
B. {3, 4}
C. {5, 6}
D. All of above
E. None of these
Answer» D. All of above
26.

What will be the output of the following query?
SELECT accountid, productid, custid
FROM account
WHERE productid NOT IN ( sav , chd , mm );

A. Only those values are selected whose productid does not belong to either sav
B. Only those values are selected whose productid does not belong to either sav , chd
C. Only those values are selected whose productid does not belong to either sav , chd , mm
D. All of above
E. None of these
Answer» D. All of above
27.

What will be the output of the following query?
SELECT customerid, productid, availbalance
FROM account
WHERE availbalance BETWEEN 2000 AND 3000.

A. Only those details will be shown whose available balance is less than 3000
B. Only those details will be shown whose as available balance form 2000 to 3000
C. Only those details will be shown whose available balance is more than 2000
D. All of above
E. None of these
Answer» C. Only those details will be shown whose available balance is more than 2000
28.

What will be the output of the following query?
SELECT *
FROM Student
WHERE start_date>= 2009-08-08 AND Start_date<= 2007-08-08

A. All employees from 2009 to 2007
B. Empty set
C. All employees between 2009 and 2007
D. All of above
E. None of these
Answer» E. None of these
29.

The following query belongs to which condition types?
SELECT firstname
FROM Employee
WHERE dept_id= (SELECT dept_id FROM department WHERE names= s );

A. Range condition
B. Equality condition
C. Inequality condition
D. All of above
E. None of these
Answer» C. Inequality condition
30.

The following query belongs to which Condition Types ?
SELECT stu_id, firstname, lastname
FROM account
WHERE start_date

A. Range condition
B. Equality conditions
C. Inequality condition
D. All of abvoe
E. None of these
Answer» B. Equality conditions
31.

Does the following query belong to the Inequality condition ?
SELECT product_type.name, product.name
FROM product_type INNER JOIN Product
ON product_type.dept=Product.dept
WHERE product_type.name! = customers_accounts ;

A. Depends
B. No
C. Yes
D. All of above
E. None of these
Answer» D. All of above
32.

What will be the result of the following query?
WHERE end_date IS NULL 
AND NOT (title= teller OR start_date < 2009-05-05 )

A. The result set contains employees who both are tellers and started working for the bank in 2009 or later
B. The result set contains employees who are only tellers
C. The result set contains non terminated employees who both are non tellers and started working for the bank from 2009 or later
D. All of above
E. None of these
Answer» D. All of above
33.

What will be the result of the following query?
WHERE end_date IS NULL 
AND (title= teller OR start_date < 2009-03-03 )

A. Only those rows are selected whose TITLE should be teller
B. Only those employee will be selected who joined the organisation prior to 2009
C. Only those rows will be selected whose end_date should be NULL
D. All of above
E. None of these
Answer» D. All of above
34.

Which of these is faster when accessing data?
memory, disk

A. same speed
B. machine dependent
C. memory
D. disk
E. None of these
Answer» D. disk
35.

The default scheduling property of MySQL is implemented by how many of these?
MyISAM, MERGE, MEMORY

A. 3
B. 2
C. 1
D. 0
E. None of these
Answer» B. 2
36.

What has higher priority?
writes, reads

A. same priority
B. machine dependent
C. writes
D. reads
E. None of these
Answer» D. reads
37.

Is there any error in this query?
SELECT emp.emp_id, emp.fname, emp.lname, dep.name FROM employee AS emp INNER JOIN department AS dep ON emp.dept_id = emp.dept_id;

A. YES
B. DEPEND
C. NO
D. All of above
E. None of these
Answer» D. All of above
38.

Is there any error in this query?
SELECT emp.emp_id, 
emp.fname, emp.lname, dep.name
FROM employee emp INNER JOIN department dep
ON emp.dept_id = emp.dept_id;

A. YES
B. DEPEND
C. NO
D. All of above
E. None of these
Answer» D. All of above
39.

How many of the following do not return rows?
SELECT, SHOW, DESCRIBE

A. 3
B. 2
C. 1
D. 0
E. None of these
Answer» E. None of these
40.

What is the number of attributes in the following table?
CREATE TABLE employee (
stu_name CHAR(50),
stu_add CHAR(50),
stu_id INT
);

A. 0
B. 1
C. 2
D. 3
E. 50
Answer» E. 50
41.

How many among the following does not return a value?
mysql_close(), mysql_init, mysql_real_connect

A. 3
B. 2
C. 1
D. 0
E. None of these
Answer» D. 0
42.

How many among the following use NULL to indicate failure?
mysql_init(), mysql_real_connect()

A. 3
B. 2
C. 1
D. 0
E. None of these
Answer» C. 1
43.

In the following query, Employee_1 belongs to which category of table in Mysql?
CREATE VIEW Employee_1 AS
SELECT firstname, lastname, Employee_id FROM Employee;

A. Virtual tables
B. Temporary tables
C. Permanent Tables
D. All of above
E. None of these
Answer» B. Temporary tables
44.

Find the missing clause from the query?
CREATE VIEW Emp_1 AS
SELECT firstname, lastname, Emp_id
_________Emp;

A. WHERE
B. SELECT
C. FROM
D. All of above
E. None of these
Answer» D. All of above
45.

Consider a database name interviewmania whose attributes are internid (primary key), subject, subjectvalue.

A. {1, 2, 3, 4, 5, 6}
B. {3, 4}
C. {1, 2, 3}
D. {5, 6}
E. None of these
Answer» B. {3, 4}
46.

The max_binlog_cache_size system variable has default size ______________.

A. 8 GB
B. 1 GB
C. 2 GB
D. 4 GB
E. None of these
Answer» E. None of these
47.

The log in which data changes received from a replication master server are written are ______________.

A. relay log
B. binary log
C. general query log
D. error log
E. None of these
Answer» B. binary log
48.

Consider a database name interviewmania whose attributes are intern_id (primary key), subject.

A. {2, 4, 5, 6}
B. {3, 4}
C. {1, 2, 3}
D. {5, 6}
E. None of these
Answer» B. {3, 4}
49.

The system variable controls the size of the table cache _________________.

A. open_cache
B. cache_open
C. cache_table
D. table_cache
E. None of these
Answer» E. None of these
50.

Consider a database name interveiwmania whose attributes are internid (primary key), subject, subjectvalue.

A. {1, 2, 3}
B. {3, 4}
C. {5, 6}
D. All of above
E. None of these
Answer» D. All of above