Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



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 customer account. The system keeps records of customers, their orders, the products included in each order, and the sales representatives responsible for handling the accounts. 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?






Solution

We need the number of distinct customers who placed orders, so we count unique customer_id from orders table.


Correct query:


Select COUNT(DISTINCT customer_id) As total_customers From orders;



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...