Best MCQ on SQL Class 12

Share with others

MCQ on SQL Class 12

MCQ on SQL
MCQ on SQL

Click for MCQ on MySQL Functions


Q1. Which of the following store data in the form of rows and columns?

a. Form

b. Report

c. Table

d. Query

Q2. The horizontal lines of table are called ______

a. Rows

b. Record

c. Both of the above

d. Attributes

Q3. The vertical lines of table are called ______

a. Rows

b. Record

c. Both of the above

d. Attributes

Q4. Which of the following is not an example of DBMS?

a. Oracle

b. MS Access

c. MySQL

d. None of the above

Q5. Which of the following type of relationship can not be formed in RDBMS?

a. One-to-One

b. One-to-Many

c. Many-to-Many

d. Many-to-All

Q6. Tuple represents a ________________ in a table.

a. Attributes

b. Columns

c. Record

d. Vertical line

Q7. Which of the following field referred to the primary key of another table?

a. Alternate Key

b. Primary Key

c. Candidate Key

d. Foreign Key

Q8. SQL stands for _____________________

a. Structured Query Lesson

b. Structured Query Language

c. Server Query Language

d. Solver Query Language

Q9. Which of the following statement is not correct in reference to MySQL?

a. It is an Open Source.

b. It is an RDBMS.

c. It is Case Sensitive.

d. It is ideal for both small and large applications.

Q10. Identify odd one out.

a. DDL

b. DML

c. DCL

d. GCL

MCQ on SQL Class 12

MCQ on SQL
MCQ on SQL

Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12

Q11. Which of the following is not the DDL commands?

a. Alter

b. Create

c. Drop

d. Select

Q12. Which command is used to change the structure of the table in MySQL?

a. Delete

b. Alter

c. Update

d. Modify

Q13. Which command is used to create the table?

a. Alter

b. Update

c. Create

d. New

Q14. Name the command used to change the existing data of the table.

a. Alter

b. Update

c. Create

d. Modify

Q15. ____________ command help to insert new record in a table.

a. Insert

b. Add

c. Use

d. Create

Q16. DML stands for __________

a. Data Manipulation Language

b. Database Manipulation Language

c. Digital Manipulation Lesson

d. Digital Manipulation Language

Q17. Which of the following is an invalid value for a field “Price” having data type as float(5,2)?

a. 12.3

b. 112.235

c. 123.2

d. 124.56

Q18. Which of the following is a fixed length string data type?

a. Char(n)

b. Varchar(n)

c. Both of the above

d. None of the above

Q19. In MySQL ____________ value represents an unknown value.

a. None

b. Null

c. Void

d. Empty

Q20. When we create a table, we can specify that a column should not contain a Null value by using _________ constraint.

a. Not Null

b. Default

c. Not Empty

d. Null

MCQ on SQL Class 12

MCQ on SQL
MCQ on SQL

Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12

Q21. Aman wants to create a database in MySQL. Help him to identify the suitable command from the following:

a. Insert

b. Create

c. Update

d. Alter

Q22. MySQL commands are case sensitive. (T/F)

a. True

b. False

Q23. Write the following steps in sequence.

1. Open Database
2. Create Database
3. Create table
4. Open MySQL

a. 4<1<2<3

b. 4<3<2<1

c. 4<2<1<3

d. 4<2<3<1

Q24. _____________ command is used to open the existing database.

a. Open

b. Use

c. New

d. Create

Q25. Which of the following statement will display all the database of the system?

a. use databases;

b. show databases;

c. show database;

d. use database;

Q26. Which command will delete the database from the system?

a. Drop

b. Delete

c. Remove

d. Clear

Q27. ____ are the rules or limitations applied on the columns of the table.

a. Protocols

b. Constraint

c. Limit

d. Constant

Q28. Commonly used constraint in MySQL is ______

a. Primary Key

b. Null

c. Candidate Key

d. None

Q29. Which constraint ensures that column can not have a NULL value?

a. Not Null

b. Null

c. Default

d. Unique

Q30. A field which uniquely identifies each and every record in a table is called ________

a. Foreign Key

b. Alternate Key

c. Composite Key

d. Primary Key

MCQ on SQL Class 12


Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12


Click for MCQ on MySQL Functions


Q31. In MySQL, Unique key accepts the NULL value.(T/F)

a. True

b. False

Q32. Command to view the structure of table is ____________

a. Desc

b. Display

c. Select

d. View

Q33. Write command to show all the records of table “document”

a. Select all from document;

b. Select * from document;

c. Display all from document;

d. Select all data from document;

Q34. Which of the following is not the valid data type of MySQL?

a. Char(8)

b. Varchar(20)

c. Float(6,2)

d. Mix(6)

Q35. It is mandatory to define constraints for each attribute of a table.(T/F)

a. True

b. False

Q36. SQL allows us to write statements for defining, modifying and deleting relation schemas. These are part of _____________.

a. DDL

b. DML

c. TCL

d. GCL

Q37. By default, each attribute can take NULL values except for the _______

a. Foreign Key

b. Primary Key

c. Both of the above

d. None of the above

Q38. Which of the following command will add primary key in a table?

a. Alter table stock added primary key(S_Id);

b. Alter table stock add primary (S_Id);

c. Alter table stock add primary key(S_Id);

d. Alter stock add primary key(S_Id);

Q39. Write a command to associate NOT NULL constraint with attribute SName of table STUDENT.

a. Alter table student add SName Varchar(20) Not Null;

b. Alter table student modify SName Varchar(20) Not Null;

c. Alter table modify SName Varchar(20) Not Null;

d. Alter table student change SName Varchar(20) Not Null;

Q40. The _______ clause is always written with SELECT clause as it specifies the name of the table from which data is to be retrieved.

a. Order by

b. From

c. Group By

d. Where

MCQ on SQL Class 12


Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12

Q41. The ________ clause is used to retrieve data according to some specified condition.

a. Where

b. From

c. Group By

d. Order By

Q42. ____________________ clause, returns records without repetition.

a. Unique

b. Primary

c. Distinct

d. Different

Q43. Write query for the following:

Display all the details of those employees whose dept_id is D12 and whose salary is more than 5000.

a. Select * from employee where dept_id = “D12” and Salary > 5000;

b. Select * from employee where dept_id = D12 and Salary > 5000;

c. Select * from employee where dept_id = “D12” and Salary is more than 5000;

d. Select * employee where dept_id = “D12” and Salary > 5000;

Q44. Consider the following query

Select * from employee where not Ename = "Ashish";

What will happen if in the above query we write “Ashish” as “ASHISH” or “ashish” or “AshiSH”? 
Will the query generate the same output or an error?

a. Same Output

b. Different Output

c. Error

d. None of the above

Q45. Consider the following query:

Select * from employee where salary between 20000 and 35000;

In above query ________________

a. both the values are not inclusive

b. both the values are inclusive

c. 20000 is inclusive and 30000 is not

d. 30000 is inclusive and 20000 is not

Q46. Which of the following is a membership operator?

a. IN

b. NOT IN

c. Both of the above

d. None of the above

Q47. Write a query to display details of all the employees except those whose dept_id number is D01 or D02.

a. Select * from employee where dept_id != (“D01”, “D02”);

b. Select * from employee where dept_id in (“D01”, “D02”);

c. Select * from employee where dept_id not in (“D01”, “D02”);

d. Select * from employee where dept_id is (“D01”, “D02”);

Q48. Identify the odd one out

a. AND

b. OR

c. SELECT

d. NOT

Q49. By default, ORDER BY clause displays records in ______

a. Ascending order

b. Descending order

c. Decreasing order

d. None of the above

Q50. ______ clause is used to display data in an ordered form with respect to a specified column.

a. FROM

b. WHERE

c. GROUP BY

d. ORDER BY

MCQ on SQL Class 12


Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12

Q51. We can specify two columns in the ORDER BY clause of MySQL?

a. True

b. False

Q52. Write a query to display the details of all those employees whose salary is unknown.

a. Select * from employee where salary is unknown;

b. Select * from employee where salary is null;

c. Select * from employee where salary =null;

d. Select * from employee where salary = “null”;

Q53. Write a query to display details of all employees who have been given a salary (i.e., salary is not null) and works in the department D1.

a. Select * from employee where salary = not null and dept_id = “D1”;

b. Select * from employee where salary is not null and dept_id = “D1”;

c. Select * from employee where salary = “not null” and dept_id = “D1”;

d. Select * from employee where salary is not null or dept_id = “D1”;

Q54. SQL provides a __________ operator that can be used with the WHERE clause to search for a specified pattern in a column.

a. NOT

b. OR

c. =

d. LIKE

Q55. In MySQL “Like” operator uses two wild characters with where clause. Identify them from the following.

a. ** and %

b. _ (underscore) and %

c. ? and &

d. _ (underscore) and ?

Q56. Which of the following wild character (use with Like) represent exactly single character?

a. *

b. %

c. _(underscore)

d. ?

Q57. Which of the following wild character (use with Like) represent multiple characters?

a. *

b. %

c. _(underscore)

d. ?

Q58. Write a query to display details of all those employees whose name starts with ‘M’.

a. Select * from Employee where ename like “M_ _ _ _”;

b. Select * from Employee where ename like “M%”;

c. Select * from Employee where ename = “M%”;

d. Select * from Employee where ename like “%M%”;

Q59. Write a query to display details of all those employees whose name ends with ‘L’.

a. Select * from Employee where ename like “_ _ _ _ L”;

b. Select * from Employee where ename like “L%”;

c. Select * from Employee where ename = “L%”;

d. Select * from Employee where ename like “%L”;

Q60. Write a query to display details of all those employees whose name contains ‘A’.

a. Select * from Employee where ename like “_ A _”;

b. Select * from Employee where ename like “A%”;

c. Select * from Employee where ename = “%A%”;

d. Select * from Employee where ename like “%A%”;

MCQ on SQL Class 12


Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12

Q61. Write a query to display details of all those employees whose name is of 4 characters and start with ‘A’.

a. Select * from employee where ename like “A_ _ _”;

b. Select * from employee where ename like “A%”;

c. Select * from employee where ename like “%A”;

d. Select * from employee where ename like = “A_ _ _”;

Q62. Write a query to display names of all employees containing ‘se’ as a substring in name.

a. Select * from employee where ename like “%se%”

b. Select * from employee where ename like %”se”%

c. Select * from employee where ename = “%se%”

d. Select * from employee where ename like “_ _ _ _se”

Q63. Update command in MySQL is _________ command

a. DDL

b. DML

c. GCL

d. TCL

Q64. What will happen if we miss the where clause in the UPDATE statement?

a. Changes will done in all records

b. Changes will happen only one record

c. Changes will not happen

d. Return Error

Q65. We can update values for more than one column using the UPDATE statement. (T/F)

a. True

b. False

Q66. ______ statement is used to remove one or more records from a table.

a. Remove

b. Del

c. Delete

d. Clear

Q67. Consider the following query:

Delete from employee;

The above command will ______________

a. delete last record from the employee table.

b. delete first record from the employee table.

c. return error.

d. delete all records from the employee table.

Q68. Which of the following is not the type of function in MySQL?

a. Single row function

b. Multiple row function

c. Aggregate function

d. Half row function

Q69. __________________is used to perform some particular task and it returns zero or more values as a result.

a. Func

b. Root

c. Function

d. Solution

Q70. Write a command to delete a record of an employee from employee table whose salary is more than 100000.

a. Delete from employee where salary > 100000;

b. Delete * from employee where salary > 100000;

c. Delete from table employee where salary > 100000;

d. Delete from employee where salary is more than 100000;

MCQ on SQL Class 12


Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12

Q71. Aggregate functions are also called ________

a. Multiple functions

b. Multiple row functions

c. Single row functions

d. Group functions

Q72. Aggregate functions return _________________ value for each column of the records on which the function is applied.

a. Single

b. Double

c. No

d. All

Q73. Which of the following functions returns one result per row?

a. Multiple Row Functions

b. Group Functions

c. Single Row Functions

d. Aggregate Functions

Q74. Identify the odd one out.

a. Max()

b. Min()

c. Count()

d. Upper()

Q75. Which of the following is Multiple row function?

a. date()

b. power()

c. count(*)

d. mid()

Q76. ___________ functions returns the largest value from the specified column.

a. Max()

b. Big()

c. Largest()

d. Sum()

Q77. ________ functions returns the smallest value from the specified column.

a. Small()

b. Least()

c. Min()

d. Mid()

Q78. Which function returns the sum of the values for the specified column?

a. Sum()

b. Add()

c. All()

d. Count()

Q79. ________ function returns the number of records in a table.

a. Count(column)

b. Count(*)

c. Select()

d. None of the above

Q80. Consider the following column of table “employee”

Salary
10000
15000
25000
10000
NULL

What would be the output of the following query?

Select Avg(Salary) from employee;

a. 15000

b. 12000

c. 20000

d. 10000

MCQ on SQL Class 12


Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12

Q81. Consider the following column of table “student”

Name
Amit
Sumit
Naina
Null

Write the output of the following query.

Select Count(*) from student;

a. 3

b. 4

c. 2

d. 1

Q82. Consider the following column of table “Teacher”

Name
Amit
Sumit
Naina
Null

Write the output of the following query.

Select Count(Name) from Teacher;

a. 3

b. 4

c. 2

d. 1

Q83. Consider the following column of table “sports”.

Category
1
2
3
2
1
4
1

Write the query for the following

Display the total number of records from table "sports" having category 1

a. Select Count(Category) from sports where Category = 1;

b. Select Count(*) from table sports where Category = 1;

c. Select Count(*) from sports where Category = 1;

d. Select Count(*) from sports having Category = 1;

Q84. Consider the following column of table “sports”.

Category
1
2
3
2
1
4
1

Write the query for the following

Display the total number of different types of category from table "sports".

a. Select Count(Category) from sports;

b. Select Count(distinct Category) from table sports;

c. Select Count(Category) from sports where Category = distinct Category;

d. Select Count(*) from sports having Category = distinct;

Q85. _____ Clause in SQL is used to specify conditions on the rows with Group By clause.

a. Order by

b. Group

c. Where

d. Having

Q86. Which clause fetch a group of rows on the basis of common values in a column?

a. Group By

b. Order By

c. Where

d. Having

Q87. Consider the table given below and answer the following questions

MCQ on SQL Class 12
MCQ on SQL Class 12

Write the query for the following:

Display the number of Cars purchased by each Customer from SALE table.

a. Select CustID, Count(*) from SALE Group by EmpID;

b. Select CustID, Count(*) “Number of Cars” from SALE Group by CustID;

c. Select CustID from SALE Group by CustID;

d. Select CustID, Count(*) from SALE Group by Invoiceno;

Q88. Refer to the table given in Q87, Write the query to display the Customer Id and number of cars purchased if the customer purchased more than 1 car from SALE table.

a. Select CustID, Count() From SALE Group by EmpID Having Count()>1;

b. Select CustID, Count() From SALE Group by CustID Where Count()>1;

c. Select CustID, Count() From SALE Order by CustID Having Count()>1;

d. Select CustID, Count() From SALE Group by CustID Having Count()>1;

Q89. Refer to the table given in Q87, Write the query to display the number of people in each category of payment mode from the table SALE.

a. Select PaymentMode, COUNT(PaymentMode) From SALE Order by Paymentmode;

b. Select PaymentMode, COUNT(PaymentMode) From SALE Group by PaymentMode;

c. Select PaymentMode From SALE Group by PaymentMode;

d. Select PaymentMode, COUNT(PaymentMode) From SALE Group by SaleDate;

Q90. Refer to the table given in Q87, Write the query to display the Payment Mode and number of payments made using that mode more than once.

a. Select PaymentMode, Count(PaymentMode) From SALE Group by Paymentmode Having Count(*)>1

b. Select PaymentMode, Count(PaymentMode) From SALE Group by Paymentmode Where Count(*)>1

c. Select PaymentMode, Count(PaymentMode) From SALE Group by Paymentmode Having Count(*)=1

d. Select PaymentMode, Count(PaymentMode) From SALE Order by Paymentmode Having Count(*)>1

MCQ on SQL Class 12


Click here to test yourself on MCQ on SQL Class 12 Questions

MCQ on SQL Class 12



Click for MCQ on MySQL Functions


Chapter Wise MCQ

1. Functions in Python

2. Flow of Control (Loop and Conditional statement)

3. 140+ MCQ on Introduction to Python

4. 120 MCQ on String in Python

5. 100+ MCQ on List in Python

6. 50+ MCQ on Tuple in Python

7. 100+ MCQ on Flow of Control in Python

8. 60+ MCQ on Dictionary in Python


Important Links

100 Practice Questions on Python Fundamentals

120+ MySQL Practice Questions

90+ Practice Questions on List

50+ Output based Practice Questions

100 Practice Questions on String

70 Practice Questions on Loops

70 Practice Questions on if-else


Disclaimer : I tried to give you the correct Questions and Answers of ”MCQ on SQL Class 12 , but if you feel that there is/are mistakes in the Questions or Answers of “MCQ on SQL Class 12 “ given above, you can directly contact me at csiplearninghub@gmail.com. The above MCQs are created for practice of students.

MCQ on SQL Class 12

MCQ on SQL Class 12

MCQ on SQL Class 12

MCQ on SQL Class 12

MCQ on SQL Class 12

MCQ on SQL Class 12

MCQ on SQL Class 12

MCQ on SQL Class 12


Share with others

Leave a Reply

error: Content is protected !!