mysql banner

MySQL Multiple Choice Questions (MCQs) and Answers

Master MySQL 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 MySQL concepts. Begin your placement preparation journey now!

Q1

Q1 What does MySQL primarily function as?

A

A web server

B

A database management system

C

A programming language

D

A browser

Q2

Q2 Which SQL statement is used to remove data from a MySQL database?

A

DELETE

B

REMOVE

C

CLEAR

D

ERASE

Q3

Q3 Which command is used to access a MySQL database via command line?

A

mysql -u user -p

B

ssh database

C

connect to mysql

D

open mysql

Q4

Q4 MySQL belongs to which category of database management systems?

A

Hierarchical DBMS

B

Network DBMS

C

Relational DBMS

D

Object-oriented DBMS

Q5

Q5 In MySQL, what does the AUTO_INCREMENT attribute automatically add to a column?

A

Random numbers

B

A timestamp

C

Unique identifiers incrementally

D

Fixed numbers

Q6

Q6 What does the following MySQL command do?
CREATE DATABASE SampleDB;

A

Creates a new table named SampleDB

B

Creates a new schema named SampleDB

C

Creates a new database named SampleDB

D

Deletes the database SampleDB

Q7

Q7 Identify the issue in the following SQL statement:
SELECT FROM users WHERE username='admin';

A

SELECT clause is incomplete

B

WHERE clause is incorrect

C

Syntax is correct

D

Missing semicolon

Q8

Q8 Which SQL clause is used to filter the records returned from a SQL query?

A

FROM

B

WHERE

C

SELECT

D

ORDER BY

Q9

Q9 SQL keywords are case sensitive.

A

All keywords are sensitive

B

Some are sensitive

C

None are sensitive

D

Depends on version

Q10

Q10 What does the DISTINCT keyword do in a SQL query?

A

Removes duplicates from results

B

Creates a distinct file

C

Orders results

D

Counts rows

Q11

Q11 What type of SQL statement is used to add new data into a database?

A

CREATE

B

SELECT

C

INSERT

D

UPDATE

Q12

Q12 What does the GROUP BY statement do in a SQL query?

A

Groups data based on one or more columns

B

Sorts the output

C

Deletes groups of data

D

Modifies data in a group

Q13

Q13 Which SQL statement is used to change data in an existing row?

A

INSERT

B

UPDATE

C

ALTER

D

CREATE

Q14

Q14 What is the default sort order of the ORDER BY statement in SQL?

A

Ascending

B

Descending

C

Random

D

Fixed

Q15

Q15 What is the result of the following SQL query?
SELECT 15 + 25;

A

40

B

'15 + 25'

C

15

D

25

Q16

Q16 Consider the following SQL command:
DELETE FROM Customers WHERE CustomerID = 3;
What does it do?

A

Deletes the customer record with CustomerID 3

B

Deletes all records from Customers

C

Updates CustomerID to 3

D

None of the above

Q17

Q17 What does the following SQL command achieve?
UPDATE Products SET Price = Price * 1.1 WHERE Category = 'Electronics';

A

Increases the price of all products by 10%

B

Decreases the price of all products by 10%

C

Increases the price of electronics products by 10%

D

None of the above

Q18

Q18 Identify the error in this SQL statement:
INSERT INTO Order (ID, Product) VALUES (101, 'Laptop');

A

Table name should be Orders

B

Syntax is correct

C

Missing semicolon at the end

D

The Product column does not exist

Q19

Q19 Which data type in MySQL is used to store boolean values?

A

TINYINT

B

SMALLINT

C

VARCHAR

D

BOOLEAN

Q20

Q20 What is the purpose of the VARCHAR data type in MySQL?

A

To store fixed-length strings

B

To store variable-length strings

C

To store large text objects

D

To store integers

Q21

Q21 Which data type would be best for storing an email address?

A

CHAR(50)

B

VARCHAR(100)

C

TEXT

D

BLOB

Q22

Q22 What is the main difference between CHAR and VARCHAR data types in MySQL?

A

CHAR stores binary data, VARCHAR does not

B

CHAR has unlimited length, VARCHAR is limited

C

CHAR is variable-length, VARCHAR is fixed-length

D

CHAR is fixed-length, VARCHAR is variable-length

Q23

Q23 In MySQL, which data type is most appropriate for storing monetary values?

A

DECIMAL

B

FLOAT

C

DOUBLE

D

INTEGER

Q24

Q24 What is the primary use of the ENUM data type in MySQL?

A

To store arrays

B

To limit input to a list of possible values

C

To create a queue structure

D

To log changes

Q25

Q25 Which SQL statement correctly creates a table with a column for storing binary data?

A

CREATE TABLE Files (Data CHAR(64));

B

CREATE TABLE Files (Data BINARY(64));

C

CREATE TABLE Files (Data TEXT);

D

CREATE TABLE Files (Data BLOB);

Q26

Q26 Consider the following SQL statement:
ALTER TABLE Employees ADD COLUMN Birthdate DATE;
What does this statement do?

A

Adds a new row called Birthdate

B

Changes the data type of Birthdate

C

Adds a new column Birthdate to store dates

D

Deletes the Birthdate column

Q27

Q27 What does the following SQL command achieve?
CREATE TABLE Orders (OrderID INT, OrderDate DATETIME DEFAULT CURRENT_TIMESTAMP);

A

Creates a table with two columns without defaults

B

Creates a table and sets a default timestamp for OrderDate

C

Creates a table and makes OrderDate a primary key

D

None of the above

Q28

Q28 What is incorrect in the following SQL statement?
CREATE TABLE Users (ID INT, Name CHAR(20), Email VARHCAR(100));

A

Spelling mistake in data type for Email

B

ID should be VARCHAR

C

Name should be TEXT

D

Syntax is correct

Q29

Q29 Identify the error in this SQL command:
CREATE TABLE Products (ProductID INT, Price DECIMAL(5));

A

DECIMAL definition is incomplete

B

Price should be an INTEGER

C

ProductID should be a TEXT

D

No error

Q30

Q30 Which SQL statement is used to read data from a database?

A

SELECT

B

INSERT

C

UPDATE

D

DELETE

ad verticalad vertical
ad