MySQL Quiz ( Beginner ) - All Questions
This beginner-level MySQL quiz is ideal for learners starting with relational databases and SQL. It covers MySQL fundamentals such as databases, tables, basic SQL commands, constraints, keys, and simple queries—perfect for practice and entry-level interviews.
Question 1: What type of database is MySQL?
- NoSQL database
- Graph database
- Relational database
- Key-value database
Explanation: MySQL is a relational database management system.
Question 2: MySQL uses which language for querying data?
Explanation: MySQL uses Structured Query Language (SQL).
Question 3: Which company currently maintains MySQL?
Explanation: MySQL is maintained by Oracle.
Question 4: What is a table in MySQL?
- A collection of databases
- A collection of rows and columns
- A SQL command
- A server process
Explanation: Tables store data in rows and columns.
Question 5: Which command shows all databases?
- LIST DATABASES
- SHOW DATABASES
- GET DATABASES
- DISPLAY DATABASES
Explanation: SHOW DATABASES lists all databases.
Question 6: Which command selects a database?
- USE database_name
- SELECT database_name
- OPEN database_name
- CONNECT database_name
Explanation: USE selects the active database.
Question 7: Which command creates a new database?
- NEW DATABASE
- ADD DATABASE
- CREATE DATABASE
- MAKE DATABASE
Explanation: CREATE DATABASE creates a database.
Question 8: Which command creates a table?
- NEW TABLE
- ADD TABLE
- MAKE TABLE
- CREATE TABLE
Explanation: CREATE TABLE defines a new table.
Question 9: What does a row represent in a table?
- A column
- A record
- A database
- An index
Explanation: A row represents a single record.
Question 10: What does a column represent?
- A table
- A record
- An attribute
- A database
Explanation: Columns represent attributes of data.
Question 11: Which SQL command retrieves data from a table?
Explanation: SELECT is used to retrieve data.
Question 12: Which command inserts data into a table?
Explanation: INSERT INTO adds new records.
Question 13: Which command updates existing records?
Explanation: UPDATE modifies existing data.
Question 14: Which command deletes records from a table?
Explanation: DELETE removes records.
Question 15: Which clause filters records?
- ORDER BY
- GROUP BY
- WHERE
- HAVING
Explanation: WHERE filters rows.
Question 16: Which clause sorts query results?
- GROUP BY
- SORT BY
- ORDER BY
- ARRANGE
Explanation: ORDER BY sorts results.
Question 17: Which keyword sorts results in descending order?
Explanation: DESC sorts in descending order.
Question 18: Which SQL function counts rows?
- SUM()
- COUNT()
- TOTAL()
- NUMBER()
Explanation: COUNT() returns number of rows.
Question 19: Which SQL function returns the highest value?
Explanation: MAX() returns the highest value.
Question 20: Which SQL function returns the lowest value?
- MIN()
- LOW()
- SMALL()
- BOTTOM()
Explanation: MIN() returns the lowest value.
Question 21: What does PRIMARY KEY do?
- Allows duplicate values
- Identifies rows uniquely
- Allows NULL values
- Creates indexes only
Explanation: Primary key uniquely identifies records.
Question 22: Can a table have multiple primary keys?
- Yes
- No
- Only in MySQL 8
- Only with joins
Explanation: A table can have only one primary key.
Question 23: What does AUTO_INCREMENT do?
- Repeats values
- Automatically increases numeric values
- Sorts data
- Encrypts data
Explanation: AUTO_INCREMENT generates unique numbers.
Question 24: Which constraint prevents NULL values?
- UNIQUE
- PRIMARY KEY
- NOT NULL
- CHECK
Explanation: NOT NULL prevents empty values.
Question 25: Which constraint ensures unique values?
Explanation: UNIQUE prevents duplicate values.
Question 26: What does DROP TABLE do?
- Deletes records only
- Deletes table structure only
- Deletes table and data
- Renames table
Explanation: DROP TABLE removes table and data.
Question 27: Which command removes all rows but keeps table structure?
Explanation: TRUNCATE removes all rows quickly.
Question 28: Which operator checks equality?
Explanation: = checks equality in SQL.
Question 29: Which operator checks inequality?
Explanation: Both != and <> check inequality.
Question 30: Which keyword limits the number of results?
Explanation: LIMIT restricts returned rows.
Question 31: Which clause groups rows?
- GROUP BY
- ORDER BY
- WHERE
- HAVING
Explanation: GROUP BY groups rows.
Question 32: Which clause filters grouped data?
- WHERE
- GROUP BY
- HAVING
- ORDER BY
Explanation: HAVING filters grouped results.
Question 33: Which JOIN returns matching records from both tables?
- LEFT JOIN
- RIGHT JOIN
- INNER JOIN
- FULL JOIN
Explanation: INNER JOIN returns matching rows.
Question 34: Which JOIN returns all records from left table?
- INNER JOIN
- RIGHT JOIN
- LEFT JOIN
- CROSS JOIN
Explanation: LEFT JOIN returns all left table rows.
Question 35: What is an index used for?
- Storing data
- Improving query performance
- Encrypting data
- Validating data
Explanation: Indexes speed up data retrieval.
Question 36: Which command creates an index?
- ADD INDEX
- MAKE INDEX
- CREATE INDEX
- NEW INDEX
Explanation: CREATE INDEX defines an index.
Question 37: Which data type stores text?
Explanation: VARCHAR stores text values.
Question 38: Which data type stores whole numbers?
Explanation: INT stores whole numbers.
Question 39: Which data type stores date values?
Explanation: DATE stores date values.
Question 40: Which function returns current date?
- NOW()
- CURTIME()
- CURRENT_DATE()
- SYSDATE()
Explanation: CURRENT_DATE() returns today's date.
Question 41: Which function returns current date and time?
- CURRENT_TIME()
- NOW()
- DATE()
- TIME()
Explanation: NOW() returns current date and time.
Question 42: Which keyword defines default value?
Explanation: DEFAULT sets a default value.
Question 43: Which MySQL feature ensures data integrity?
- Indexes
- Constraints
- Views
- Triggers
Explanation: Constraints enforce data rules.
Question 44: What is a view in MySQL?
- A physical table
- A virtual table based on a query
- An index
- A stored procedure
Explanation: Views are virtual tables.
Question 45: Which command shows table structure?
- SHOW TABLE
- DESCRIBE table_name
- STRUCTURE table
- INFO table
Explanation: DESCRIBE shows table schema.
Question 46: Which storage engine is default in MySQL?
Explanation: InnoDB is the default engine.
Question 47: What is the main advantage of InnoDB?
- Faster reads only
- Transaction support
- Less storage
- No indexes
Explanation: InnoDB supports transactions.
Question 48: What is the main goal of MySQL?
- Frontend rendering
- Relational data management
- File storage
- Cache management
Explanation: MySQL manages relational data.