SQL Aptitude Test - 25 MCQ Questions with Answers

This post presents a SQL aptitude test with 25 multiple-choice questions for beginners. These beginner-level MCQ questions cover the fundamentals of SQL.

1. What does SQL stand for?

a) Structured Query Language
b) Simple Query Language
c) Standard Query Language
d) None of the above

2. Which SQL statement is used to extract data from a database?

a) GET
b) EXTRACT
c) SELECT
d) PULL

3. How do you select all the columns from a table named "Customers"?

a) SELECT * FROM Customers
b) SELECT [all] FROM Customers
c) EXTRACT * FROM Customers
d) GET * FROM Customers

4. What is the default sort order of the ORDER BY statement in SQL?

a) Descending
b) Random
c) Ascending
d) Alphabetical

5. Which SQL statement is used to update data in a database?

a) UPDATE
b) MODIFY
c) CHANGE
d) ALTER

6. What does the WHERE clause do in SQL?

a) Specifies which columns to display
b) Specifies which tables to use
c) Filters records that fulfil a specified condition
d) Orders the output of the results

7. How do you insert a new row into a table?

a) INSERT INTO table_name VALUES (value1, value2)
b) ADD TO table_name VALUES (value1, value2)
c) INSERT NEW ROW INTO table_name (value1, value2)
d) CREATE NEW ROW IN table_name (value1, value2)

8. Which SQL statement is used to delete data from a database?

a) DELETE
b) REMOVE
c) DROP
d) CLEAR

9. Which SQL keyword is used to sort the result set?

a) SORT BY
b) ORDER BY
c) ALIGN BY
d) GROUP BY

10. How do you count the number of rows in a table?

a) COUNT(*)
b) SUM(rows)
c) TOTAL(*)
d) CALCULATE(*)

11. What does the GROUP BY statement do?

a) Sorts the result set
b) Groups the result set by one or more columns
c) Combines all result sets into one
d) Updates groups in the result set

12. Which SQL keyword is used to specify a condition that must be fulfilled?

a) FULFILL
b) HAVING
c) MUST
d) WHERE

13. What is the purpose of the JOIN clause in SQL?

a) To combine rows from two or more tables
b) To insert new data
c) To delete existing data
d) To update data based on a condition

14. How do you select all records from a table where the "FirstName" is "John"?

a) SELECT * FROM table WHERE FirstName = 'John'
b) SELECT * FROM table WHERE FirstName == 'John'
c) SELECT FirstName FROM table WHERE FirstName = 'John'
d) GET * FROM table WHERE FirstName LIKE 'John'

15. What is an index in SQL?

a) A unique identifier for each row
b) A way to speed up searches/queries
c) A column that must contain unique values
d) The last column in a table

16. Which SQL function returns the current date and time?

a) NOW()
b) CURRENT_DATE()
c) GETDATE()
d) TODAY()

17. What is SQL injection?

a) A method to secure SQL databases
b) Illegal deletion of data
c) The insertion of malicious SQL statements into code
d) A type of SQL function

18. Which statement is true about primary keys?

a) There can be multiple primary keys in a table
b) A primary key column cannot contain null values
c) A primary key automatically sorts the data in ascending order
d) All of the above

19. What does the LIKE operator do in SQL?

a) Updates data to match a pattern
b) Searches for a specified pattern in a column
c) Checks if one value is like another
d) Limits the number of rows returned

20. How do you rename a column in SQL?

a) RENAME COLUMN old_name TO new_name
b) ALTER TABLE table_name RENAME COLUMN old_name TO new_name
c) CHANGE COLUMN old_name new_name
d) UPDATE TABLE table_name RENAME old_name TO new_name

21. Which clause is used to filter records before any group calculations?

a) BEFORE
b) WHERE
c) HAVING
d) FILTER

22. How do you delete a table in SQL?

a) DELETE TABLE table_name
b) DROP TABLE table_name
c) REMOVE TABLE table_name
d) ERASE TABLE table_name

23. What is a foreign key?

a) A key that uniquely identifies each row in a table
b) A key used for linking two tables together
c) A key that only accepts numerical values
d) A primary key from one table that is used in another table

24. Which SQL statement is used to create a new table?

a) CREATE TABLE
b) NEW TABLE
c) MAKE TABLE
d) BUILD TABLE

25. What does the DISTINCT keyword do in SQL?

a) Selects only unique values from a column
b) Ignores all duplicate values in a query's results
c) Performs an action only on the different values
d) Deletes all duplicate records from a table

Comments