Learn MySQL with 20+ multiple-choice questions and answers on its basic concepts, data types, and commands. Test your knowledge and improve your skills.
Contents
hide
What does SQL stand for?
- Structured Query Language
- Structured Question Language
- Standard Query Language
- Standard Question Language
Answer: a) Structured Query Language
Which of the following is not a data type in MySQL?
- VARCHAR
- TEXT
- INT2
- DECIMAL
Answer: c) INT2
Which command is used to delete a table in MySQL?
- DELETE TABLE
- DROP TABLE
- REMOVE TABLE
- ERASE TABLE
Answer: b) DROP TABLE
Which statement is used to add a new row to a table in MySQL?
- ADD ROW
- INSERT ROW
- CREATE ROW
- UPDATE ROW
Answer: b) INSERT ROW
Which of the following is a valid MySQL date format?
- DD-MM-YYYY
- YYYY-MM-DD
- MM-DD-YYYY
- DD/MM/YYYY
Answer: b) YYYY-MM-DD
Which statement is used to retrieve data from a MySQL database?
- GET
- SELECT
- FETCH
- RETRIEVE
Answer: b) SELECT
Which operator is used to compare values in MySQL?
- =
- ==
- ===
- ><
Answer: a) =
Which command is used to change the name of a table in MySQL?
- CHANGE TABLE
- ALTER TABLE
- MODIFY TABLE
- RENAME TABLE
Answer: d) RENAME TABLE
Which MySQL data type would you use to store a decimal number with up to 10 digits?
- DECIMAL(10)
- DOUBLE
- FLOAT(10)
- NUMERIC
Answer: a) DECIMAL(10)
Which command is used to update existing data in a MySQL table?
- UPDATE
- MODIFY
- CHANGE
- SET
Answer: d) SET
What is the maximum length of a VARCHAR data type in MySQL?
- 255 characters
- 65,535 characters
- 4,294,967,295 characters
- There is no maximum length
Answer: b) 65,535 characters
Which MySQL command is used to display a list of all databases?
- SHOW TABLES
- SHOW DATABASES
- DISPLAY DATABASES
- LIST DATABASES
Answer: b) SHOW DATABASES
Which MySQL function is used to count the number of rows in a table?
- COUNT()
- ROWS()
- LENGTH()
- SIZE()
Answer: a) COUNT()
Which keyword is used to sort data in a MySQL query in ascending order?
- DESC
- ASC
- SORT
- ORDER BY
Answer: b) ASC
Which MySQL command is used to add a new column to a table?
- ALTER TABLE
- ADD COLUMN
- UPDATE TABLE
- MODIFY TABLE
Answer: b) ADD COLUMN
What is the default port number for MySQL?
- 80
- 3306
- 5432
- 8080
Answer: b) 3306
Which MySQL function is used to return the current date and time?
- NOW()
- CURRENT_TIMESTAMP()
- SYSDATE()
- DATE()
Answer: b) CURRENT_TIMESTAMP()
Which MySQL command is used to delete a table?
- DROP TABLE
- DELETE TABLE
- REMOVE TABLE
- CLEAR TABLE
Answer: a) DROP TABLE
Which keyword is used to select all columns in a MySQL query?
- ALL
- EVERYTHING
- *
- SELECT
Answer: c) *
Which MySQL command is used to create a new database?
- CREATE DATABASE
- ADD DATABASE
- INSERT DATABASE
- MAKE DATABASE
Answer: a) CREATE DATABASE
Which MySQL operator is used to check if a value is not equal to another value?
- !=
- <>
- NOT EQUAL
- <>
Answer: d) <>
Which MySQL function is used to find the highest value in a column?
- MAX()
- HIGHEST()
- LARGEST()
- TOP()
Answer: a) MAX()