All mock tests are FREE till 31 December — register to save your progress
Unit 4 · Database Management Systems Paper 2 CS · June 2024 (Cancelled Exam)

Directions (Q96–100): A company is implementing a new database system to manage its customer information. The database contains tables for customers, orders, products and sales representatives. Each customer can place multiple orders and each order can contain multiple products. Each order is associated with a specific sales representative who manages the account. The database is designed to improve efficiency in tracking sales and customer interactions.

Which SQL query retrieves the total number of distinct customers who have placed orders?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: A. SELECT COUNT(DISTINCT customer_id) AS total_customers FROM orders;

Explanation

Only customers appearing in the orders table have placed orders, and DISTINCT counts each once.

More Database Management Systems questions