Last Updated On
Welcome to the SQL Quiz! This blog post features 25 multiple-choice questions that explore essential concepts of SQL.
1. What does SQL stand for?
Select the best answer
a) Structured Query Language
b) Strong Question Language
c) Structured Question Language
d) None
2. What command is used to create a new table in SQL?
Choose one option
a) CREATE TABLE
b) GENERATE TABLE
c) BUILD TABLE
d) NONE
3. Which SQL statement is used to extract data from a database?
Choose one option
a) SELECT
b) GET
c) OPEN
d) EXTRACT
4. In a database, what is a unique identifier for each record in a table called?
Choose one option
a) Primary key
b) Secondary key
c) Foreign key
d) Index key
5. What is the purpose of normalization in a database?
Choose one option
a) Increase data redundancy
b) Optimize query speed
c) Reduce data redundancy
d) Improve data security
6. What type of database model organizes data in tables with rows and columns?
a) Hierarchical
b) Network
c) Relational
d) Object-Oriented
7. What does the following statement in SQL do?
DROP TABLE Student;
a) Deletes a table called Student
b) Creates a table called Student
c) Check if there is a table called Student
d) None
8. Which SQL statement is used to update data in a database?
Choose one option
a) UPDATE
b) SAVE
c) MODIFY
d) SAVE AS
9. Which SQL statement is used to insert new data in a database?
Choose one option
a) INSERT INTO
b) ADD NEW
c) ADD RECORD
d) INSERT NEW
10. Which SQL statement is used to delete data from a database?
Choose one option
a) DELETE
b) REMOVE
c) COLLAPSE
11. Which statement(s) are mandatory in a simple SQL SELECT statement?
Choose one option
a) Select, From
b) Select, OrderBy
c) Select, Where
d) Select, GroupBy
12. Which character is used to separate SQL statements in database systems?
Choose one option
a) :
b) %
c) _
d) ;
13. Which command should be used to change the datatype of a column in an SQL table?
Choose one option
a) CREATE
b) ALTER
c) DROP
d) TRUNCATE
14. What is the difference between the DROP and TRUNCATE commands in SQL?
Choose one option
a) DROP deletes the table, TRUNCATE deletes only the table data
b) TRUNCATE deletes the table, DROP deletes only the table data
c) No difference
d) Both commands modify table data
15. Which part of this statement is incorrect?
CREATE TABEL Students (ID int, Name varchar(50));
Choose one option
a) TABEL
b) Students
c) ID int
d) Name varchar(50)
16. With SQL, how do you select a column named “FirstName” from table named “Students”?
Choose one option
a) SELECT FirstName FROM Students
b) SELECT Students.FirstName
c) EXTRACT FirstName FROM Students
d) None
17. With SQL, how do you select all the columns from a table named “Students”?
Choose one option
a) SELECT * FROM Students
b) SELECT [all] FROM Students
c) SELECT *.Students
d) SELECT Students
18. With SQL, how do you select all the records from a table named “Students” where the value of the column “FirstName” is “Peter”?
Choose one option
a) SELECT * FROM Students WHERE FirstName='Peter'
b) SELECT * FROM Students WHERE FirstName<>'Peter'
c) SELECT [all] FROM Students WHERE FirstName LIKE 'Peter'
d) SELECT [all] FROM Students WHERE FirstName='Peter'
19. With SQL, how do you select all the records from a table named “Students” where the value of the column “FirstName” starts with an “a”?
a) SELECT * FROM Students WHERE FirstName LIKE 'a%'
b) SELECT * FROM Students WHERE FirstName='%a%'
c) SELECT * FROM Students WHERE FirstName='a'
d) SELECT * FROM Students WHERE FirstName LIKE '%a'
20. How does a transaction ensure data integrity in SQL?
Choose one option
a) By locking the database
b) By allowing multiple users to modify data simultaneously
c) By ensuring all operations within the transaction are completed before committing
d) By automatically updating all related tables
21. Correct the syntax error in
CREATE TABLE Students (ID int PRIMARY, Name varchar(50));
a) PRIMARY
b) ID int
c) Name varchar(50)
d) CREATE TABLE
22. What is missing for this statement to be correct?
ALTER TABLE Students ADD COLUMN Email varchar(50);
a) ADD COLUMN
b) Email
c) varchar(50)
d) All Correct
23. What does the UPDATE command in SQL do?
a) Deletes a record
b) Modifies an existing record
c) Adds a new record
d) Retrieves data
24. In SQL, what is the purpose of the WHERE clause in a DELETE statement?
a) Specifies which database to use
b) Specifies which table to delete from
c) Specifies which records to delete
d) Specifies how to order the records
25. What needs to be corrected in the below query?
SELECT Name FROM Employees WHERE Age > 30 AND Department = 'HR';
a) All Correct
b) SELECT keyword
c) WHERE clause
d) AND operator
====================================================================
Additional MCQ for SQL