SQL Programming Advanced Quiz 1
Select your answers and check your results. Use Reset to start again.
Search
Practice Pronunciation (Merriam-Webster)
Navigation
Python Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Python Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Python Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
SQL Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
SQL Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
SQL Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
JavaScript Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
JavaScript Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
JavaScript Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C# Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C# Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C# Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Java Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Java Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Java Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C Programming Beginner Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C Programming Intermediate Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
C Programming Advanced Quizzes
Quiz 1,
Quiz 2,
Quiz 3,
Quiz 4,
Quiz 5
Advanced Quiz 1
1. What is the difference between INNER JOIN and LEFT JOIN?
INNER JOIN returns only matching rows; LEFT JOIN returns all rows from the left table and matching rows from the right.
INNER JOIN returns all rows; LEFT JOIN returns only matching rows.
INNER JOIN returns unmatched rows; LEFT JOIN returns matched rows.
2. Write a SQL query to find the second highest salary from an "Employees" table.
SELECT MAX(salary) FROM Employees WHERE salary < (SELECT MAX(salary) FROM Employees);
SELECT TOP 2 salary FROM Employees;
SELECT salary FROM Employees ORDER BY salary DESC LIMIT 2;
3. Explain the concept of normalization. What are the different normal forms?
Normalization organizes data to reduce redundancy and improve integrity; common forms include 1NF, 2NF, 3NF, BCNF.
Normalization is about backing up data regularly.
Normalization means encrypting data.
4. Write a SQL query to retrieve all employees who have the job title "Manager".
SELECT * FROM Employees WHERE job_title = 'Manager';
SELECT * FROM Employees WHERE job_title LIKE '%Manager%';
SELECT * FROM Employees WHERE title = 'Manager';
5. What is a subquery? Write a SQL query using a subquery to find products priced higher than the average price.
SELECT * FROM Products WHERE price > (SELECT AVG(price) FROM Products);
SELECT * FROM Products WHERE price > AVG(price);
SELECT * FROM Products WHERE price > ALL (SELECT price FROM Products);
6. Write a SQL query to count the number of orders placed by each customer in an "Orders" table.
SELECT customer_id, COUNT(*) AS order_count FROM Orders GROUP BY customer_id;
SELECT customer_id, SUM(*) FROM Orders;
SELECT customer_id, TOTAL(*) FROM Orders;
7. Explain the use of indexes in SQL. How do they improve query performance?
Indexes speed up data retrieval by allowing quick lookups on columns, reducing full table scans.
Indexes slow down queries.
Indexes store data redundantly.
8. Write a SQL query to find customers who have not placed any orders.
SELECT * FROM Customers WHERE customer_id NOT IN (SELECT customer_id FROM Orders);
SELECT * FROM Customers WHERE customer_id IN (SELECT customer_id FROM Orders);
SELECT * FROM Customers WHERE customer_id = NULL;
9. What is a CTE (Common Table Expression)? Write a query using a CTE to calculate total sales per product.
WITH SalesCTE AS (SELECT product_id, SUM(amount) AS total_sales FROM Sales GROUP BY product_id) SELECT * FROM SalesCTE;
CREATE CTE SalesCTE AS SELECT product_id, SUM(amount) FROM Sales;
SELECT product_id, SUM(amount) FROM Sales CTE;
10. Write a SQL query to retrieve the top 5 highest-paid employees.
SELECT * FROM Employees ORDER BY salary DESC LIMIT 5;
SELECT TOP 5 * FROM Employees ORDER BY salary;
SELECT * FROM Employees WHERE salary >= 5;
Previous
Check Quiz
Reset
Next
Other
Timer
00:00
Start
Stop
Reset
Vocabulary Quiz
Score: 0
Reset Score
Submit Answer
Next Word
Spin the Wheel
SPIN
Promo's
Explore More
C# Documentation
C# Tutorials