-
What is the purpose of the CONCAT_WS() function in MySQL?
- A) To concatenate values from multiple rows into a single string
- B) To concatenate values with a specified separator
- C) To return the first non-null value in a list of expressions
- D) To calculate the average value of a numeric column
Answer: B) To concatenate values with a specified separator
-
Which SQL command is used to change the data type of an existing column in MySQL?
- A) CHANGE COLUMN
- B) MODIFY COLUMN
- C) ALTER COLUMN
- D) UPDATE COLUMN
Answer: B) MODIFY COLUMN
-
What is the purpose of the COALESCE() function in MySQL?
- A) To concatenate values from multiple rows into a single string
- B) To return the first non-null value in a list of expressions
- C) To calculate the average value of a numeric column
- D) To count the number of rows in a table
Answer: B) To return the first non-null value in a list of expressions
-
Which SQL command is used to remove a database from MySQL?
- A) DELETE DATABASE
- B) DROP DATABASE
- C) REMOVE DATABASE
- D) ERASE DATABASE
Answer: B) DROP DATABASE
-
What is the purpose of the TIMESTAMP data type in MySQL?
- A) To store date and time values with fractional seconds
- B) To store only date values
- C) To store only time values
- D) To store only year values
Answer: A) To store date and time values with fractional seconds
-
Which SQL function is used to return the current date and time in MySQL?
- A) CURRENT_TIMESTAMP()
- B) NOW()
- C) GETDATE()
- D) CURDATE()
Answer: B) NOW()
-
What is the purpose of the GROUP BY clause in conjunction with aggregate functions in MySQL?
- A) To filter rows based on a specified condition
- B) To perform aggregate functions on grouped data
- C) To combine rows from two or more tables
- D) To sort the result set by a specified column
Answer: B) To perform aggregate functions on grouped data
-
Which SQL command is used to create a new user in MySQL?
- A) CREATE USER
- B) ADD USER
- C) MAKE USER
- D) INSERT USER
Answer: A) CREATE USER
-
What is the purpose of the RAND() function in MySQL?
- A) To generate a random number
- B) To round a numeric value to a specified number of decimal places
- C) To calculate the average value of a numeric column
- D) To return the first non-null value in a list of expressions
Answer: A) To generate a random number
-
Which SQL command is used to grant specific privileges to a user in MySQL?
- A) ALLOW
- B) GRANT
- C) PERMIT
- D) AUTHORIZE
Answer: B) GRANT
Comments