1/14
Looks like no tags are added yet.
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.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.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. 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.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
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
Which join returns matching records from both tables?
A. INNER JOIN
B. LEFT JOIN
C. FULL OUTER JOIN
D. CROSS JOIN
A. INNER JOIN
Which clause is used to eliminate duplicate rows?
A. UNIQUE
B. DISTINCT
C. GROUP BY
D. FILTER
B. DISTINCT
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
Which SQL clause is used to search for NULL values?
A. = NULL
B. IS NULL
C. NULL =
D. LIKE NULL
B. IS NULL
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
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.
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
Which normal form requires each cell to contain a single value?
A. 1NF
B. 2NF
C. 3NF
D. BCNF
A. 1NF
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