Create New Post

MYSQL MCQs - 5

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

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

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

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

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

  6. 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()

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

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

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

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

Leave a Reply

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

60091