Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

SQL_MCQ_Beginners

The document contains a series of multiple-choice questions designed to test basic SQL knowledge for beginners. It covers various SQL commands and concepts, including data retrieval, filtering, updating, and sorting. Each question provides four options, with one correct answer related to SQL syntax and functionality.

Uploaded by

shivani.6947s
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

SQL_MCQ_Beginners

The document contains a series of multiple-choice questions designed to test basic SQL knowledge for beginners. It covers various SQL commands and concepts, including data retrieval, filtering, updating, and sorting. Each question provides four options, with one correct answer related to SQL syntax and functionality.

Uploaded by

shivani.6947s
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

SQL Multiple-Choice Questions for Beginners

1. Which of the following commands is used to retrieve all records from a

table?

a) SELECT * FROM table_name; b) UPDATE table_name; c) DELETE FROM

table_name; d) INSERT INTO table_name;

2. What is the correct syntax to filter records where the "salary" is greater than

5000?

a) SELECT * FROM employees WHERE salary = 5000; b) SELECT * FROM

employees FILTER salary > 5000;

c) SELECT * FROM employees WHERE salary > 5000; d) SELECT * FROM

employees ORDER BY salary > 5000;

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

a) SORT DESCENDING b) ORDER DESCENDING c) DESC ORDER d) ORDER

BY DESC

4. How do you change the value of the "email" column in the "users" table for a

specific user?

a) ALTER TABLE users SET email; b) MODIFY email IN users;

c) UPDATE users SET email = 'newemail@example.com' WHERE user_id = 1;

d) CHANGE users email 'newemail@example.com';

5. Which clause is used to filter data in SQL?

a) ORDER BY b) FILTER c) WHERE d) GROUP BY

6. What does the following query do?

`UPDATE products SET price = price * 1.10 WHERE category = 'electronics';`

a) Deletes all products in the electronics category b) Increases the price of

electronics by 10%

c) Filters out electronics products d) Displays electronics products without


price changes

7. How do you select employees whose names start with the letter 'A'?

a) SELECT * FROM employees WHERE name = 'A%'; b) SELECT * FROM

employees WHERE name LIKE 'A%';

c) SELECT * FROM employees WHERE name IN 'A'; d) SELECT * FROM

employees ORDER BY name 'A%';

8. How do you order data by "salary" in ascending order?

a) ORDER BY salary DESC; b) ORDER BY salary ASC; c) SORT BY salary; d)

GROUP BY salary ASC;

9. Which SQL statement is used to update data in a table?

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

10. How do you retrieve unique values from a column in SQL?

a) SELECT UNIQUE column_name FROM table_name; b) SELECT DISTINCT

column_name FROM table_name;

c) SELECT DIFFERENT column_name FROM table_name; d) SELECT VARIED

column_name FROM table_name;

11. What will the following SQL query do?

`DELETE FROM employees WHERE department = 'Sales';`

a) Adds new employees to the Sales department b) Removes all employees

from the Sales department

c) Displays employees in the Sales department d) Modifies employee details in

the Sales department

12. Which of the following correctly filters records for ages between 18 and 25?

a) WHERE age BETWEEN 18, 25 b) WHERE age >= 18 AND age <= 25

c) WHERE age BETWEEN 18 TO 25 d) WHERE age IN RANGE (18, 25)

13. Which clause groups records with the same values in specified columns?

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


14. What does this SQL command do?

`SELECT * FROM students WHERE grade > 80 ORDER BY grade DESC;`

a) Deletes students with grades over 80 b) Filters students with grades over 80

and sorts them in descending order

c) Updates grades of students d) Filters students with grades below 80

15. How do you update the "status" column to "active" for users aged over 30?

a) ALTER TABLE users SET status = 'active';

b) UPDATE users SET status = 'active' WHERE age > 30;

c) CHANGE TABLE users status TO 'active';

d) MODIFY users SET status 'active' FOR age > 30;

16. What does the following SQL query do?

`SELECT name, salary FROM employees WHERE department = 'HR' ORDER BY

salary ASC;`

a) Updates the salary of HR employees b) Deletes HR employees with low

salaries

c) Selects names and salaries of HR employees, sorted by salary in ascending

order

d) Filters out HR department employees without sorting

17. How do you sort a result set by multiple columns?

a) ORDER BY column1, column2 b) SORT column1 AND column2

c) GROUP BY column1, column2 d) FILTER BY column1, column2

18. What does the following query do?

`SELECT COUNT(*) FROM orders WHERE status = 'Shipped';`

a) Counts total orders in the table b) Counts orders with a status of "Shipped"

c) Displays all shipped orders d) Deletes shipped orders from the table

19. How do you select records where "city" is either 'Delhi' or 'Mumbai'?

a) WHERE city = 'Delhi' AND city = 'Mumbai'


b) WHERE city IN ('Delhi', 'Mumbai')

c) WHERE city BETWEEN 'Delhi' AND 'Mumbai'

d) WHERE city LIKE 'Delhi' OR 'Mumbai'

20. What does this query do?

`SELECT name, MAX(salary) FROM employees;`

a) Selects all employee names and their salaries

b) Selects the employee with the highest salary

c) Selects the highest salary and all employee names

d) Selects names of employees without considering salary

You might also like