sql banner

SQL Multiple Choice Questions (MCQs) and Answers

Master SQL with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of SQL. Begin your placement preparation journey now!

Q1

Q1 What type of database model organizes data in tables with rows and columns?

A

Hierarchical

B

Network

C

Relational

D

Object-Oriented

Q2

Q2 In a database, what is a unique identifier for each record in a table called?

A

Primary key

B

Secondary key

C

Foreign key

D

Index key

Q3

Q3 Which SQL statement is used to retrieve data from a database?

A

UPDATE

B

DELETE

C

INSERT

D

SELECT

Q4

Q4 What is the purpose of normalization in a database?

A

Increase data redundancy

B

Optimize query speed

C

Reduce data redundancy

D

Improve data security

Q5

Q5 Which of the following is not a characteristic of a good database design?

A

Data integrity

B

Data redundancy

C

Scalability

D

Efficiency

Q6

Q6 Which data type is used in SQL to store true or false values?

A

INT

B

BOOLEAN

C

VARCHAR

D

FLOAT

Q7

Q7 In SQL, which data type is best suited for storing large texts such as articles or comments?

A

TEXT

B

VARCHAR

C

CHAR

D

BLOB

Q8

Q8 Which SQL data type is used to store numerical values with fixed precision and scale?

A

DECIMAL

B

INTEGER

C

DATE

D

VARCHAR

Q9

Q9 In SQL, what is the difference between CHAR and VARCHAR data types?

A

CHAR is fixed length, VARCHAR is variable length

B

CHAR is variable length, VARCHAR is fixed length

C

No difference

D

VARCHAR is used only for numeric data

Q10

Q10 What data type would you use in SQL to store a date and time value together?

A

DATETIME

B

DATE

C

TIME

D

TIMESTAMP

Q11

Q11 Which SQL command is used to create a new table in a database?

A

CREATE

B

ALTER

C

DROP

D

TRUNCATE

Q12

Q12 What does the DROP command do in SQL?

A

Adds a new row to a table

B

Deletes an existing table

C

Modifies a table

D

Creates a new table

Q13

Q13 In SQL, what is the purpose of the TRUNCATE command?

A

Deletes specific rows from a table

B

Removes all rows from a table

C

Changes table structure

D

Creates a new table

Q14

Q14 Which command should be used to change the datatype of a column in an SQL table?

A

CREATE

B

ALTER

C

DROP

D

TRUNCATE

Q15

Q15 What is the difference between the DROP and TRUNCATE commands in SQL?

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

Q16

Q16 Which part of this statement is incorrect?

"CREATE TABEL Students (ID int, Name varchar(50));"

A

TABEL

B

Students

C

ID int

D

Name varchar(50)

Q17

Q17 Identify the error in
"ALTER TABLE Students DROP COLUMN DateOfBirth date;"

A

ALTER TABLE

B

DROP COLUMN

C

DateOfBirth

D

date

Q18

Q18 What needs to be changed in
"TRUNCATE Students;" to make it a valid SQL statement?

A

TRUNCATE

B

Students

C

All Correct

D

Add a WHERE clause

Q19

Q19 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

Q20

Q20 In "ALTER TABLE Students ADD COLUMN Email varchar(50),
what is missing for this statement to be correct?

A

ADD COLUMN

B

Email

C

varchar(50)

D

All Correct

Q21

Q21 Which SQL command is used to add a new record to a table?

A

SELECT

B

DELETE

C

UPDATE

D

INSERT

Q22

Q22 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

Q23

Q23 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

Q24

Q24 Which command is used to remove a specific record from a table in SQL?

A

DELETE

B

UPDATE

C

INSERT

D

SELECT

Q25

Q25 How does a transaction ensure data integrity in SQL?

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

Q26

Q26 In the query "SELECT Name FROM Employees WHERE Age > 30 AND Department = 'HR';",
what needs to be corrected?

A

All Correct

B

The SELECT keyword

C

The WHERE clause

D

The AND operator

Q27

Q27 Identify the error in
"UPDATE Employees SET Salary = Salary * 1.05 WHERE;"

A

UPDATE keyword

B

SET keyword

C

WHERE clause

D

No error

Q28

Q28 What is missing in the following statement?

"INSERT INTO Employees (Name, Department) VALUES ('John', 'Sales');"

A

All Correct

B

Employee ID

C

A WHERE clause

D

Additional column names

Q29

Q29 Correct the syntax error in
"DELETE FROM Employees HAVING Age < 25;"

A

DELETE keyword

B

FROM keyword

C

HAVING keyword

D

No syntax error

Q30

Q30 In "UPDATE Employees SET Age = Age + 1 WHERE Department IN ('Sales', 'HR') AND Age >= 30;",
identify the error.

A

The IN operator

B

The AND operator

C

No error

D

The SET keyword

ad vertical
ad