SQL MCQ Part – 1

Welcome to your SQL part 1

1. 
Which SQL keyword is used to specify the number of rows to retrieve in a SELECT statement?

2. 
Which SQL keyword is used to create an index on one or more columns in a table?

3. 
Which SQL function is used to convert a value to lowercase?

4. 
Which SQL statement is used to insert data into a table?

5. 
Which SQL keyword is used to add a new row of data to an existing table?

6. 
Which SQL function is used to retrieve the length of a string?

7. 
Which SQL function is used to round a numeric value to a specified number of decimal places?

8. 
Which SQL keyword is used to specify a negation in a WHERE clause?

9. 
Which SQL keyword is used to combine rows from two or more tables based on a related column?

10. 
Which SQL function is used to retrieve the current date and time?

11. 
Which SQL keyword is used to filter groups in a HAVING clause?

12. 
. Which SQL keyword is used to specify an alternative condition in a WHERE clause?

13. 
Which SQL keyword is used to add a new column to an existing table?

14. 
Which SQL keyword is used to combine the result sets of two or more SELECT statements?

15. 
Which SQL keyword is used to sort data in ascending order?

16. 
Which SQL keyword is used to retrieve unique values from a column in a SELECT statement?

17. 
Which type of JOIN returns all the rows from the right table and the matched rows from the left table?

18. 
Which SQL keyword is used to perform calculations on grouped data in a SELECT statement?

19. 
Which SQL keyword is used to create a new table in a database?

20. 
Which SQL keyword is used to filter data based on multiple values in a WHERE clause?

21. 
Which SQL keyword is used to specify the starting position for retrieving rows in a SELECT statement?

22. 
Which SQL keyword is used to check the existence of specified values in a subquery in a WHERE clause?

23. 
Which SQL keyword is used to specify multiple conditions in a WHERE clause?

24. 
Which keyword is used to retrieve data from a SQL database?

25. 
Which SQL keyword is used to group rows based on a specified column in a SELECT statement?

26. 
Which type of JOIN returns all the rows from the left table and the matched rows from the right table?

27. 
Which SQL keyword is used to filter data within a range of values in a WHERE clause?

28. 
Which SQL keyword is used to specify a column alias in a SELECT statement?

29. 
Which SQL function is used to calculate the average of a numeric column?

30. 
Which SQL function is used to calculate the total of a numeric column?

31. 
Which SQL statement is used to delete data from a table?

32. 
Which SQL statement is used to modify existing data in a table?

33. 
Which SQL function is used to concatenate two or more strings into a single string?

34. 
Which SQL keyword is used to sort data in descending order?

35. 
Which SQL keyword is used to filter data based on a pattern match in a WHERE clause?

36. 
Which SQL keyword is used to specify a wildcard character in a pattern matching operation?

37. 
Which type of JOIN returns all the rows from both tables, filling in NULL values for unmatched rows?

38. 
Which type of JOIN returns only the rows that have matching values in both tables being joined?

39. 
Which SQL function is used to convert a value to uppercase?

40. 
. Which SQL keyword is used to filter data in a WHERE clause?

41. 
Which SQL function is used to count the number of rows in a table?

SQL MCQ Part – 2

Certainly! Here are 20 SQL questions and answers:

Q: What is SQL?

A: SQL (Structured Query Language) is a programming language used for managing and manipulating relational databases.

Q: What are the main components of an SQL statement?

A: An SQL statement consists of keywords, expressions, and clauses such as SELECT, FROM, WHERE, GROUP BY, HAVING, and ORDER BY.

Q: What is a database in SQL?

A: A database in SQL is a collection of organized data that is stored and accessed using a database management system (DBMS).

Q: What is a table in SQL?

A: A table in SQL is a structured data object that stores related data in rows and columns.

Q: How do you create a table in SQL?

A: You can create a table in SQL using the CREATE TABLE statement, specifying the table name and column definitions.

Q: What is a primary key in SQL?

A: A primary key in SQL is a column or a combination of columns that uniquely identifies each row in a table.

Q: What is a foreign key in SQL?

A: A foreign key in SQL is a column that establishes a link or relationship between two tables based on the values in the respective columns.

Q: What is a JOIN in SQL?

A: JOIN is an SQL operation used to combine records from two or more tables based on a related column between them.

Q: What is the difference between INNER JOIN and OUTER JOIN?

A: INNER JOIN returns only the matching records between two tables, while OUTER JOIN returns all records from both tables, including unmatched records.

Q: What is a WHERE clause in SQL?

A: A WHERE clause in SQL is used to filter records based on a specified condition or criteria.

Q: What is the purpose of the GROUP BY clause in SQL?

A: The GROUP BY clause in SQL is used to group rows based on one or more columns and apply aggregate functions to each group.

Q: What are aggregate functions in SQL?

A: Aggregate functions in SQL are functions that perform calculations on a set of values and return a single value, such as SUM, AVG, COUNT, MIN, and MAX.

Q: What is a subquery in SQL?

A: A subquery in SQL is a query nested within another query, used to retrieve data that depends on the result of the outer query.

Q: What is the purpose of the ORDER BY clause in SQL?

A: The ORDER BY clause in SQL is used to sort the result set in ascending or descending order based on one or more columns.

Q: What is a view in SQL?

A: A view in SQL is a virtual table derived from one or more tables, which can be queried like a regular table.

Q: What is normalization in SQL?

A: Normalization is the process of organizing data in a database to eliminate redundancy and improve data integrity.

Q: What is a stored procedure in SQL?

A: A stored procedure in SQL is a set of pre-compiled SQL statements that are stored in the database and can be executed repeatedly.

Q: What is ACID in the context of database transactions?

A: ACID stands for Atomicity, Consistency, Isolation, and Durability, which are properties that ensure the reliability and integrity of database transactions.

Q: What is a trigger in SQL?

A: A trigger in SQL is a set of SQL statements that are automatically executed or fired in response to specified database events, such as INSERT, UPDATE, or DELETE operations.

Q: What is the purpose of the UNION operator in SQL?

A: The UNION operator in SQL is used to combine the result sets of two or more SELECT statements into a single result set, removing duplicate rows.

More Questions ->