πŸ“Š MySQL
Q. What does this query return?
Code:
SELECT CONCAT('My', 'SQL');
  • (A) My SQL
  • (B) My-SQL
  • (C) MySQL
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) MySQL

Explanation: `CONCAT()` joins two or more strings together.

πŸ“Š MySQL
Q. Which keyword is used to remove all records from a table without deleting the structure?
  • (A) DELETE
  • (B) DROP
  • (C) TRUNCATE
  • (D) REMOVE
πŸ’¬ Discuss
βœ… Correct Answer: (C) TRUNCATE

Explanation: `TRUNCATE` removes all records but keeps the table structure intact.

πŸ“Š MySQL
Q. Which command is used to view all databases in MySQL?
  • (A) SHOW DATABASES;
  • (B) LIST DATABASES;
  • (C) SELECT ALL DATABASES;
  • (D) DISPLAY DATABASES;
πŸ’¬ Discuss
βœ… Correct Answer: (A) SHOW DATABASES;

Explanation: `SHOW DATABASES;` lists all databases available on the server.

πŸ“Š MySQL
Q. Which command gives you the structure of a table?
  • (A) SHOW ALL FROM table;
  • (B) SHOW COLUMNS FROM table;
  • (C) DESCRIBE table;
  • (D) LIST table;
πŸ’¬ Discuss
βœ… Correct Answer: (C) DESCRIBE table;

Explanation: `DESCRIBE table;` shows column definitions and other metadata.

πŸ“Š MySQL
Q. What does `UNION` do in SQL?
  • (A) Combines rows from two tables and removes duplicates
  • (B) Updates records in two tables
  • (C) Creates a new table
  • (D) Links tables permanently
πŸ’¬ Discuss
βœ… Correct Answer: (A) Combines rows from two tables and removes duplicates

Explanation: `UNION` combines results of two `SELECT` queries and removes duplicate rows.

πŸ“Š MySQL
Q. Which MySQL function is used to get the current date and time?
  • (A) GETDATE()
  • (B) NOW()
  • (C) SYSDATE()
  • (D) CURRENT()
πŸ’¬ Discuss
βœ… Correct Answer: (B) NOW()

Explanation: `NOW()` returns the current date and time in MySQL.

πŸ“Š MySQL
Q. What does this query do?
Code:
SELECT name FROM students WHERE age BETWEEN 18 AND 22;
  • (A) Selects students older than 18
  • (B) Selects students younger than 22
  • (C) Selects students aged exactly 18 and 22
  • (D) Selects students aged between 18 and 22 inclusive
πŸ’¬ Discuss
βœ… Correct Answer: (D) Selects students aged between 18 and 22 inclusive

Explanation: `BETWEEN` includes both boundary values: 18 and 22.

πŸ“Š MySQL
Q. Which SQL keyword is used to remove duplicate rows from the result set?
  • (A) REMOVE DUPLICATES
  • (B) DISTINCT
  • (C) UNIQUE
  • (D) DELETE DUPLICATE
πŸ’¬ Discuss
βœ… Correct Answer: (B) DISTINCT

Explanation: `DISTINCT` eliminates duplicate values from the result.

πŸ“Š MySQL
Q. What does `AUTO_INCREMENT` do in MySQL?
  • (A) Creates an index automatically
  • (B) Inserts random values
  • (C) Automatically increases column value
  • (D) Sorts values in ascending order
πŸ’¬ Discuss
βœ… Correct Answer: (C) Automatically increases column value

Explanation: `AUTO_INCREMENT` is used for automatically incrementing a numeric column.

πŸ“Š MySQL
Q. Which clause is used with GROUP BY to filter grouped results?
  • (A) WHERE
  • (B) HAVING
  • (C) IF
  • (D) FILTER
πŸ’¬ Discuss
βœ… Correct Answer: (B) HAVING

Explanation: `HAVING` is used to filter groups created by `GROUP BY`.