Create New Post

MYSQL MCQs - 2

  1. Which SQL command is used to retrieve specific columns from a table in MySQL?

    • A) GET
    • B) FETCH
    • C) SELECT
    • D) FILTER

    Answer: C) SELECT

  2. Which SQL function is used to calculate the average value of a numeric column in MySQL?

    • A) AVG()
    • B) MEAN()
    • C) AVERAGE()
    • D) SUM()

    Answer: A) AVG()

  3. What is the purpose of the ORDER BY clause in MySQL?

    • A) To filter rows based on a specified condition
    • B) To group rows together based on a specified column
    • C) To join multiple tables together
    • D) To sort the result set by a specified column

    Answer: D) To sort the result set by a specified column

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

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

    Answer: B) DELETE

  5. What is the purpose of the HAVING clause in MySQL?

    • A) To filter rows based on a specified condition after grouping
    • B) To specify the columns to retrieve in the result set
    • C) To perform aggregate functions on grouped data
    • D) To specify the table to perform the operation on

    Answer: A) To filter rows based on a specified condition after grouping

  6. Which SQL command is used to change the name of a table in MySQL?

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

    Answer: B) RENAME TABLE

  7. What is the purpose of the LIMIT clause in MySQL?

    • A) To specify the number of rows to retrieve in the result set
    • B) To specify the table to perform the operation on
    • C) To join multiple tables together
    • D) To filter rows based on a specified condition

    Answer: A) To specify the number of rows to retrieve in the result set

  8. Which SQL function is used to find the maximum value of a column in MySQL?

    • A) MAX()
    • B) HIGHEST()
    • C) TOP()
    • D) LARGEST()

    Answer: A) MAX()

  9. What is the purpose of the DISTINCT keyword in MySQL?

    • A) To specify the columns to retrieve in the result set
    • B) To filter rows based on a specified condition
    • C) To retrieve distinct values from a column in the result set
    • D) To perform aggregate functions on grouped data

    Answer: C) To retrieve distinct values from a column in the result set

  10. Which SQL command is used to modify an existing table structure in MySQL?

    • A) UPDATE TABLE
    • B) ALTER TABLE
    • C) MODIFY TABLE
    • D) CHANGE TABLE

    Answer: B) ALTER TABLE

Comments

Leave a Reply

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

34983