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!

Q151

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

A

Hierarchical

B

Network

C

Relational

D

Object-Oriented

Q152

Q152 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

Q153

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

A

UPDATE

B

DELETE

C

INSERT

D

SELECT

Q154

Q154 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

Q155

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

A

Data integrity

B

Data redundancy

C

Scalability

D

Efficiency

Q156

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

A

INT

B

BOOLEAN

C

VARCHAR

D

FLOAT

Q157

Q157 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

Q158

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

A

DECIMAL

B

INTEGER

C

DATE

D

VARCHAR

Q159

Q159 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

Q160

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

A

DATETIME

B

DATE

C

TIME

D

TIMESTAMP

Q161

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

A

CREATE

B

ALTER

C

DROP

D

TRUNCATE

Q162

Q162 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

Q163

Q163 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

Q164

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

A

CREATE

B

ALTER

C

DROP

D

TRUNCATE

Q165

Q165 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

Q166

Q166 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)

Q167

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

A

ALTER TABLE

B

DROP COLUMN

C

DateOfBirth

D

date

Q168

Q168 What needs to be changed in 'TRUNCATE TABLE Students;' to make it a valid SQL statement?

A

Change 'TRUNCATE' to 'DELETE'

B

Remove 'TABLE'

C

Change 'Students' to 'Student'

D

No error

Q169

Q169 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

Q170

Q170 Identify the error in "ALTER TABLE Students ADD COLUMN Email varchar(50);"

A

Add 'COLUMN' after 'ADD'

B

Change 'varchar(50)' to 'varchar2(50)'

C

Change 'Email' to 'EmailID'

D

No error

Q171

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

A

SELECT

B

DELETE

C

UPDATE

D

INSERT

Q172

Q172 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

Q173

Q173 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

Q174

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

A

DELETE

B

UPDATE

C

INSERT

D

SELECT

Q175

Q175 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

Q176

Q176 What needs to be corrected in the query "SELECT Name FROM Employees WHERE Age > 30 AND Department = 'HR';"?

A

Replace 'AND' with 'OR'

B

Change 'Age > 30' to 'Age < 30'

C

Change 'Department = 'HR'' to 'Department == 'HR''

D

No error

Q177

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

A

UPDATE keyword

B

SET keyword

C

WHERE clause

D

No error

Q178

Q178 What is missing in "INSERT INTO Employees (Name, Department) VALUES ('John', 'Sales');"

A

Add a closing parenthesis after 'Sales'

B

Remove the opening parenthesis before 'Name'

C

Include 'ID' column in the INSERT statement

D

No error

Q179

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

A

DELETE keyword

B

FROM keyword

C

HAVING keyword

D

No syntax error

Q180

Q180 Identify the error in "UPDATE Employees SET Age = Age + 1 WHERE Department IN ('Sales', 'HR') AND Age >= 30;"

A

Change 'Age = Age + 1' to 'Age = Age - 1'

B

Replace 'IN' with 'NOT IN'

C

Remove 'AND Age >= 30'

D

No error

ad vertical
ad