Create New Post

MYSQL MCQs - 4

  1. What is the purpose of the GROUP_CONCAT() function in MySQL?

    • A) To calculate the average value of a numeric column
    • B) To concatenate values from multiple rows into a single string
    • C) To find the maximum value of a column
    • D) To count the number of rows in a table

    Answer: B) To concatenate values from multiple rows into a single string

  2. Which SQL command is used to revoke privileges from a user in MySQL?

    • A) REVOKE
    • B) DENY
    • C) WITHDRAW
    • D) REMOVE

    Answer: A) REVOKE

  3. What is the purpose of the LEFT JOIN in MySQL?

    • A) To combine rows from two or more tables based on a related column
    • B) To filter rows based on a specified condition
    • C) To perform aggregate functions on grouped data
    • D) To retrieve all records from the left table and matching records from the right table

    Answer: D) To retrieve all records from the left table and matching records from the right table

  4. Which SQL command is used to remove an index from a table in MySQL?

    • A) DELETE INDEX
    • B) DROP INDEX
    • C) REMOVE INDEX
    • D) ERASE INDEX

    Answer: B) DROP INDEX

  5. What is the purpose of the IS NULL operator in MySQL?

    • A) To check if a value is not null
    • B) To check if a value is null
    • C) To filter rows based on a specified condition
    • D) To specify the columns to retrieve in the result set

    Answer: B) To check if a value is null

  6. Which SQL function is used to round a numeric value to a specified number of decimal places in MySQL?

    • A) ROUND()
    • B) TRUNCATE()
    • C) CEIL()
    • D) FLOOR()

    Answer: A) ROUND()

  7. What is the purpose of the LIKE operator in conjunction with the % wildcard in MySQL?

    • A) To match any single character
    • B) To match any sequence of characters
    • C) To match zero or more occurrences of a character
    • D) To match one or more occurrences of a character

    Answer: B) To match any sequence of characters

  8. Which SQL command is used to rename an existing column in a table in MySQL?

    • A) RENAME COLUMN
    • B) MODIFY COLUMN
    • C) CHANGE COLUMN
    • D) ALTER COLUMN

    Answer: C) CHANGE COLUMN

  9. 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

  10. Which SQL command is used to create a new database in MySQL?

    • A) CREATE DATABASE
    • B) NEW DATABASE
    • C) ADD DATABASE
    • D) MAKE DATABASE

    Answer: A) CREATE DATABASE

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

11377