Create New Post

MYSQL MCQs - 10

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

    • A) To return the maximum value of a column
    • B) To return the minimum value of a column
    • C) To return the average value of a column
    • D) To return the total value of a column

    Answer: C) To return the average value of a column

  2. Which SQL command is used to create a foreign key constraint in MySQL?

    • A) ADD FOREIGN KEY
    • B) CREATE FOREIGN KEY
    • C) FOREIGN KEY
    • D) SET FOREIGN KEY

    Answer: A) ADD FOREIGN KEY

  3. What is the purpose of the SUBSTRING() function in MySQL?

    • A) To extract a part of a string
    • B) To return the length of a string
    • C) To concatenate two or more strings
    • D) To convert a string to uppercase

    Answer: A) To extract a part of a string

  4. Which SQL function is used to return the current month in MySQL?

    • A) MONTH()
    • B) CURRENT_MONTH()
    • C) GETMONTH()
    • D) CURMONTH()

    Answer: A) MONTH()

  5. What is the purpose of the UPPER() function in MySQL?

    • A) To return the maximum value of a column
    • B) To return the minimum value of a column
    • C) To convert a string to uppercase
    • D) To convert a string to lowercase

    Answer: C) To convert a string to uppercase

  6. Which SQL command is used to create a table in MySQL?

    • A) ADD TABLE
    • B) CREATE TABLE
    • C) MAKE TABLE
    • D) SET TABLE

    Answer: B) CREATE TABLE

  7. What is the purpose of the MIN() function in MySQL?

    • A) To return the maximum value of a column
    • B) To return the minimum value of a column
    • C) To return the average value of a column
    • D) To return the total value of a column

    Answer: B) To return the minimum value of a column

  8. Which SQL command is used to delete a column from a table in MySQL?

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

    Answer: C) DROP COLUMN

  9. What is the purpose of the CURRENT_TIMESTAMP() function in MySQL?

    • A) To return the current date
    • B) To return the current time
    • C) To return the current date and time
    • D) To return the difference between two dates

    Answer: C) To return the current date and time

  10. Which SQL function is used to return the number of rows in a table in MySQL?
    - A) ROW_COUNT() - B) COUNT_ROWS() - C) NUM_ROWS() - D) COUNT()
    Answer: D) COUNT()
     

Comments

Leave a Reply

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

53799