Home Videos Exercises MCQ Q&A Quiz E-Store Services Blog Sign in Appointment Payment

SQL MCQ

Soopro Pathshala provides SQL MCQ(Multiple Choice Questions)


1. How many primary keys can have in a table?

a) only 1

b) only 2

c) depends on no of columns

d) depends on DBA

View Answer

Answer: (a) only 1



2. Which of the following is not constraint in SQL?

a) Primary Key

b) Not null

c) Check

d) Union

View Answer

Answer: (d) union



3. Which operator is used to compare a value to a specified list of values?

a) ANY

b) BETWEEN

c) ALL

d) IN

View Answer

Answer: (d) IN



4. What operator tests column for absence of data?

a) NOT Operator

b) Exists Operator

c) IS NULL Operator

d) None of the above

View Answer

Answer: (c) IS NULL Operator



5. ____ is not a category of SQL command.

a) TCL

b) SCL

c) DCL

d) DDL

View Answer

Answer: (b) SCL



6. Which of the following are TCL commands?

a) UPDATE and TRUNCATE

b) SELECT and INSERT

c) GRANT and REVOKE

d) ROLLBACK and SAVEPOINT

View Answer

Answer: (d) ROLLBACK and SAVEPOINT



7. Which operator performs pattern matching?

a) Between operator

b) LIKE operator

c) EXISTS operator

d) none of these

View Answer

Answer: (b) LIKE operator



8. In sql which command is used to SELECT only one copy of each set of duplicate rows?

a) select Distinct

b) select unique

c) select different

d) all of the above

View Answer

Answer: (a) select Distinct



9. IWhich operator is used to compare the NULL values in SQL?

a) Equal

b) IN

c) IS

d) none of above

View Answer

Answer: (c) IS



10. ______ is NOT a type of constraint in SQL language?

a) FOREIGN KEY

b) PRIMARY KEY

c) UNIQUE

d) ALTERNATE KEY

View Answer

Answer: (d) ALTERNATE KEY



11. ________ is a program that performs some common action on database data and also stored in the database.

a) Stored Procedure

b) Trigger

c) Stored Function

d) none of the above

View Answer

Answer: (a) Stored Procedure



12. Which of the following are types of Unicode character string types in SQL?

a) nchar

b) ntext

c) both a and b

d) none of the above

View Answer

Answer: (c) both a and b



13. Which of the following commands is used to delete all rows and free up space from a table?

a) Truncate

b) Drop

c) DELETE

d) ALTER

View Answer

Answer: (a) Truncate



14. Which of the following commands are a part of data control language?

a) Revoke

b) Grant

c) both a and b

d) none of the above

View Answer

Answer: (c) both a and b



15. Which SQL constraint do we use to set some value to a field whose value has not been added explicitly?

a) UNIQUE

b) NOT NULL

c) DEFAULT

d) CHECK

View Answer

Answer: (c) DEFAULT



16. What are rows of a relation known as?

a) Degree

b) Entity

c) Tuple

d) None

View Answer

Answer: (c) Tuple



17. During transaction before commit which of the following statements is done automatically in case of shutdown?

a) Rollback

b) Commit

c) View

d) Flashback

View Answer

Answer: (a) Rollback



18. Which SQL keyword is used to retrive a maximum value?

a) MOST

b) TOP

c) MAX

d) UPPER

View Answer

Answer: (c) MAX



19. If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default ______

a) ASC

b) DESC

c) There is no default value

d) none of the mentioned

View Answer

Answer: (a) ASC



20. Which SQL function is used to count the number of rows in a SQL query?

a) COUNT()

b) NUMBER()

c) SUM()

d) COUNT(*)

View Answer

Answer: (d) COUNT(*)



21. In DBMS, table is known as _____ and row is known as _____.

a) Relation, Tuple

b) Tuple, Tuple

c) Tuple, Relation

d) Relation, Relation

View Answer

Answer: (a) Relation, Tuple



22. To delete table definition and all data from the table, which statement is used?

a) DELETE

b) DROP

c) ALTER

d) none of the above

View Answer

Answer: (b) DROP



23. TRUNCATE TABLE requires.

a) WHERE clause

b) HAVING clause

c) both a and b

d) none of the above

View Answer

Answer: (d) none of the above



24. How many temp tables are there?

a) 1

b) 2

c) 3

d) 4

View Answer

Answer: (b) 2



25. Which of the following are the types of the temp tables?

a) Local Temp

b) Global Temp

c) both a and b

d) none of the above

View Answer

Answer: (c) both a and b



26. Local Temp Variable is used with which sign?

a) ?

b) @

c) #

d) &

View Answer

Answer: (c) #



27. Global Temp Variable is used with which sign?

a) ###

b) ####

c) #

d) ##

View Answer

Answer: (d) ##



28. Which keyword is used to create a new table in SQL?

a) CREATE

b) ADD

c) INSERT

d) UPDATE

View Answer

Answer: (a) CREATE



29. Which keyword is used to update data in a table in SQL?

a) ADD

b) UPDATE

c) MODIFY

d) REPLACE

View Answer

Answer: (b) UPDATE



30. Which keyword is used to delete data from a table in SQL?

a) DELETE

b) REMOVE

c) ERASE

d) PURGE

View Answer

Answer: (a) DELETE



31. Which keyword is used to add a new column to a table in SQL?

a) ADD COLUMN

b) NEW COLUMN

c) INSERT COLUMN

d) APPEND COLUMN

View Answer

Answer: (a) ADD COLUMN



32. Which keyword is used to remove a column from a table in SQL?

a) DROP COLUMN

b) REMOVE COLUMN

c) ERASE COLUMN

d) DELETE COLUMN

View Answer

Answer: (a) DROP COLUMN



33. Which keyword is used to rename a table in SQL?

a) RENAME TABLE

b) RENAME

c) CHANGE TABLE

d) MODIFY TABLE

View Answer

Answer: (a) RENAME TABLE



34. Which keyword is used to sort data in a table in SQL?

a) ORDER

b) SORT

c) ARRANGE

d) SEQUENCE

View Answer

Answer: (a) ORDER



35. Which keyword is used to group data in a table in SQL?

a) GROUP

b) ARRANGE

c) SORT

d) CATEGORIZE

View Answer

Answer: (a) GROUP



36. Which keyword is used to calculate the average of a column in a table in SQL?

a) COUNT

b) SUM

c) AVG

d) MAX

View Answer

Answer: (c) AVG



37. Which keyword is used to join two or more tables in SQL?

a) JOIN

b) CONNECT

c) COMBINE

d) RELATE

View Answer

Answer: (a) JOIN



38. Which type of join returns only the matching rows from both tables in SQL?

a) INNER JOIN

b) LEFT JOIN

c) RIGHT JOIN

d) FULL OUTER JOIN

View Answer

Answer: (a) INNER JOIN



39. Which type of join returns all the rows from the right table and matching rows from the left table in SQL?

a) INNER JOIN

b) LEFT JOIN

c) RIGHT JOIN

d) FULL OUTER JOIN

View Answer

Answer: (c) RIGHT JOIN



40. Which type of join returns all the rows from both tables in SQL?

a) INNER JOIN

b) LEFT JOIN

c) RIGHT JOIN

d) FULL OUTER JOIN

View Answer

Answer: (d) FULL OUTER JOIN