sample sql mcqs

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

15 Terms

1
New cards

What will the following SQL query return?

SELECT DISTINCT City

FROM Customers;

a) All cities including duplicates

b) Only unique cities

c) First occurrence of each city

d) Last occurrence of each city

b) Only unique cities

2
New cards

2.What will this query return?

SELECT COUNT(*)

FROM Employees

WHERE Salary > 50000;

a) Sum of all salaries

b) Number of employees with salary > 50000

c) Average salary

d) Maximum salary

b) Number of employees with salary > 50000

3
New cards

3.What will this query return?

SELECT Name, City

FROM CUSTOMERS

WHERE City = 'London';

a) All customer details

b) Names and cities of London customers only

c) Only customer names

d) Only cities

b) Names and cities of London customers only

4
New cards

4. This query will find:

SELECT COUNT(*)

FROM ORDERS;

a) Sum of all orders

b) Total number of orders

c) Average order amount

d) Sum of customers


b) Total number of orders

5
New cards

5.What does this query show?

SELECT Department, AVG(Salary)

FROM EMPLOYEES

GROUP BY Department;

a) Highest salary per department

b) Total salary per department

c) Average salary per department

d) Number of employees per department

c) Average salary per department

6
New cards

This query returns:

SELECT Name, Price

FROM PRODUCTS

WHERE Price > 100

ORDER BY Price DESC;

a) All products

b) Products under $100

c) Products over $100, most expensive first

d) Products over $100, cheapest first

c) Products over $100, most expensive first

7
New cards

Which join returns matching records from both tables?

A. INNER JOIN

B. LEFT JOIN

C. FULL OUTER JOIN

D. CROSS JOIN

A. INNER JOIN

8
New cards

Which clause is used to eliminate duplicate rows?

A. UNIQUE

B. DISTINCT

C. GROUP BY

D. FILTER

B. DISTINCT

9
New cards

What does the BETWEEN operator do?

A. Matches multiple values

B. Checks range of values

C. Checks NULL values

D. Joins tables

B. Checks range of values

10
New cards

Which SQL clause is used to search for NULL values?

A. = NULL

B. IS NULL

C. NULL =

D. LIKE NULL

B. IS NULL

11
New cards

A relation is in 1NF and has a composite primary key. A non-key attribute depends

on only one part of the composite key. Which normal form is violated?

A. 1NF

B. 2NF

C. 3NF

D. BCNF


B. 2NF

12
New cards

A relation is in 2NF, but a non-key attribute depends transitively on the primary key

through another non-key attribute. Which statement is correct?

A. The relation is necessarily in 3NF.

B. The relation violates 1NF.

C. The relation violates 3NF.

D. The relation is necessarily in BCNF.

C. The relation violates 3NF.

13
New cards

What is normalization?

A. Adding more data to a table

B. Organizing data to reduce redundancy

C. Deleting all duplicate records manually

D. Creating more users in a database

B. Organizing data to reduce redundancy

14
New cards

Which normal form requires each cell to contain a single value?

A. 1NF

B. 2NF

C. 3NF

D. BCNF

A. 1NF

15
New cards

What is data redundancy?

A. Missing data in a table

B. Repeating the same data unnecessarily

C. Deleting data from a table

D. Sorting data alphabetically