πŸ“Š MySQL
Q. What does this query do?
Code:
SELECT MAX(price) FROM products;
  • (A) Selects all prices
  • (B) Selects the maximum price
  • (C) Selects the average price
  • (D) Selects the minimum price
πŸ’¬ Discuss
βœ… Correct Answer: (B) Selects the maximum price

Explanation: `MAX()` returns the highest value in the specified column.

πŸ“Š MySQL
Q. Which data type is suitable for storing large text in MySQL?
  • (A) VARCHAR
  • (B) TEXT
  • (C) CHAR
  • (D) STRING
πŸ’¬ Discuss
βœ… Correct Answer: (B) TEXT

Explanation: `TEXT` is designed to hold large strings of text.

πŸ“Š MySQL
Q. What is the default port for MySQL?
  • (A) 1433
  • (B) 3306
  • (C) 1521
  • (D) 8080
πŸ’¬ Discuss
βœ… Correct Answer: (B) 3306

Explanation: The default port used by MySQL is 3306.

πŸ“Š MySQL
Q. What is the purpose of the `DEFAULT` keyword in table creation?
  • (A) Sets default query
  • (B) Specifies default schema
  • (C) Sets a default value for a column
  • (D) Initializes the database
πŸ’¬ Discuss
βœ… Correct Answer: (C) Sets a default value for a column

Explanation: `DEFAULT` sets a default value for a column if none is provided during insertion.

πŸ“Š MySQL
Q. What does this query do?
Code:
SELECT name FROM employees WHERE name LIKE '%son';
  • (A) Names ending with 'son'
  • (B) Names containing 'son'
  • (C) Names starting with 'son'
  • (D) All employee names
πŸ’¬ Discuss
βœ… Correct Answer: (A) Names ending with 'son'

Explanation: `'%son'` matches names that end with 'son'.

πŸ“Š MySQL
Q. Which SQL statement is used to change data in a table?
  • (A) UPDATE
  • (B) MODIFY
  • (C) CHANGE
  • (D) SET
πŸ’¬ Discuss
βœ… Correct Answer: (A) UPDATE

Explanation: `UPDATE` is used to modify existing records in a table.

πŸ“Š MySQL
Q. How do you delete all rows from a table named `orders`?
  • (A) REMOVE FROM orders;
  • (B) DELETE ALL FROM orders;
  • (C) DELETE FROM orders;
  • (D) ERASE FROM orders;
πŸ’¬ Discuss
βœ… Correct Answer: (C) DELETE FROM orders;

Explanation: `DELETE FROM orders;` removes all records from the table.

πŸ“Š MySQL
Q. What is the purpose of `JOIN` in MySQL?
  • (A) To split tables
  • (B) To combine rows from two or more tables
  • (C) To delete multiple rows
  • (D) To aggregate rows
πŸ’¬ Discuss
βœ… Correct Answer: (B) To combine rows from two or more tables

Explanation: `JOIN` is used to combine rows from two or more tables based on a related column.

πŸ“Š MySQL
Q. Which of these is not a valid MySQL JOIN type?
  • (A) INNER JOIN
  • (B) OUTER JOIN
  • (C) LEFT JOIN
  • (D) CROSS JOIN
πŸ’¬ Discuss
βœ… Correct Answer: (B) OUTER JOIN

Explanation: MySQL doesn't support the `OUTER JOIN` keyword directly; use `LEFT` or `RIGHT` joins.

πŸ“Š MySQL
Q. Which function returns the length of a string in MySQL?
  • (A) STRLEN()
  • (B) LENGTH()
  • (C) SIZE()
  • (D) LEN()
πŸ’¬ Discuss
βœ… Correct Answer: (B) LENGTH()

Explanation: `LENGTH()` returns the number of bytes used by a string.