SQL Online Quiz

Welcome to our SQL Online Quiz, crafted to evaluate your knowledge and skills in SQL (Structured Query Language), the standard language for managing relational databases. This quiz covers a range of topics, from basic query syntax and data manipulation to complex joins, subqueries, and the use of SQL functions. Whether you're a beginner learning the basics or an experienced developer looking to test your SQL prowess, these questions will provide a comprehensive review and challenge your understanding.

1. What does SQL stand for?

a) Standard Query Language
b) Structured Query Language
c) Simple 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 a column named "FirstName" from a table called "Employees"?

a) SELECT FirstName FROM Employees
b) EXTRACT FirstName FROM Employees
c) GET FirstName FROM Employees
d) PULL FirstName FROM Employees

4. What SQL clause is used to filter the results of a query?

a) FILTER
b) WHERE
c) CHECK
d) VALIDATE

5. Which SQL statement is used to insert new data into a database?

a) INSERT INTO
b) ADD RECORD
c) UPLOAD
d) COMMIT

6. How do you find the number of rows in a table?

a) SELECT COUNT(*) FROM table_name
b) COUNT ROWS IN table_name
c) GET NUMBER OF ROWS IN table_name
d) SELECT ROWS FROM table_name

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

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

8. How do you eliminate duplicate rows in a query result set?

a) SELECT UNIQUE
b) SELECT DISTINCT
c) SELECT DIFFERENT
d) SELECT SINGLE

9. What is an SQL JOIN?

a) A command to exclude matching records from tables
b) A command to find the average value of a numeric column
c) A clause used to combine rows from two or more tables
d) A filter to use on date-type columns

10. Which type of JOIN returns all records when there is a match in either the left table or the right table?

a) INNER JOIN
b) LEFT JOIN
c) RIGHT JOIN
d) FULL OUTER JOIN

11. What SQL clause is used to limit the number of records returned?

a) LIMIT
b) BOUND
c) RESTRICT
d) CONSTRAIN

12. What is the default sort order of the "ORDER BY" clause in SQL?

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

13. Which SQL function is used to return the current date and time?

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

14. How do you add a column to an existing SQL table?

a) ADD COLUMN column_name TO table_name
b) ALTER TABLE table_name ADD column_name datatype
c) UPDATE TABLE table_name ADD column_name datatype
d) MODIFY TABLE table_name ADD column_name datatype

15. Which statement is used to remove a table in SQL?

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

16. What does the GROUP BY statement do in a SQL query?

a) Groups the result set by one or more columns
b) Sorts the result set by groups
c) Groups the description of columns
d) Organizes the tables into groups

17. Which SQL keyword is used to specify a condition that all rows must satisfy?

a) AND
b) LIKE
c) MUST
d) HAVING

18. How do you change the data in an existing row?

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

19. Which SQL function is used to return the largest value of the selected column?

a) MAX()
b) BIGGEST()
c) UPPER()
d) TOP()

20. What is the SQL command to create a new database?

a) CREATE DB
b) NEW DATABASE
c) MAKE DATABASE
d) CREATE DATABASE

21. What is the correct SQL syntax to delete records where the "FirstName" is 'John'?

a) DELETE FROM table_name WHERE FirstName = 'John'
b) DELETE ROWS FROM table_name WHERE FirstName = 'John'
c) REMOVE FROM table_name WHERE FirstName = 'John'
d) ERASE FROM table_name WHERE FirstName = 'John'

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

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

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

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

24. Which type of join returns only the rows that have a match in both joined tables?

a) INNER JOIN
b) OUTER JOIN
c) LEFT JOIN
d) RIGHT JOIN

25. What is the purpose of SQL constraints?

a) To specify rules for the data in a table
b) To make the query run faster
c) To provide indexing for a table
d) To establish relationships between tables

Comments