Learn MYSQL MCQs

Prepare MYSQL MCQs (Multiple choice Questions) for exam and job interviews.

Which command is used to grant privileges to a user?

1) GRANT ALL ON database_name TO user_name;

2) ALLOW ALL ON database_name FOR user_name;

3) GIVE ALL TO user_name;

4) SET PRIVILEGES ON database_name FOR user_name;

Answer : Option 1

What is the use of the SQL CONCAT() function?

1) To concatenate two or more strings

2) To find the length of a string

3) To convert a string to uppercase

4) To format date values

Answer : Option 1

Which command is used to retrieve data from a MySQL table?

1) SELECT * FROM table_name;

2) GET ALL FROM table_name;

3) RETRIEVE FROM table_name;

4) SHOW table_name;

Answer : Option 1

What is a MySQL stored procedure?

1) A set of SQL statements that can be stored and executed

2) A backup of a database

3) A type of index

4) A temporary table

Answer : Option 1

How do you rename a table in MySQL?

1) ALTER TABLE old_table_name RENAME TO new_table_name;

2) RENAME TABLE old_table_name TO new_table_name;

3) CHANGE TABLE old_table_name TO new_table_name;

4) MODIFY TABLE old_table_name AS new_table_name;

Answer : Option 1

What is the function of the SQL ROUND() function?

1) Rounds a numeric value to a specified number of decimal places

2) Finds the average value

3) Calculates the sum

4) Finds the maximum value

Answer : Option 1

How can you fetch the current user in MySQL?

1) SELECT CURRENT_USER();

2) SELECT USER();

3) SELECT ACTIVE_USER();

4) SELECT SESSION_USER();

Answer : Option 1

What does the SQL command SHOW TABLES do?

1) Displays a list of all tables in a database

2) Creates a new table

3) Deletes a table

4) Modifies a table

Answer : Option 1

Which command is used to create a view in MySQL?

1) CREATE VIEW view_name AS SELECT columns FROM table_name;

2) ADD VIEW view_name AS SELECT columns FROM table_name;

3) DEFINE VIEW view_name FROM SELECT columns;

4) NEW VIEW view_name AS SELECT columns;

Answer : Option 1

What is the purpose of the SQL EXPLAIN statement?

1) Provides information about how MySQL executes a query

2) Creates a new table

3) Updates data

4) Fetches records

Answer : Option 1