>> customer table i have 1000 customers,Of which 900 customers have orders in the salesorder table.

means 900 customers placed orders in the salesorder(Select Customer.CustomerID from salesorder) -- gives 900 different customerIds--Original querySelect * from customer where customer.CustomerID in (Select Customer.CustomerID from salesorder) -- made condition to check which customer had placed order

So obviously you will get 900 customers who placed orders

NOTE: IN operator checks for matching customers in the customer and salesorder tables

EDIT: I'm sorry.... I haven't seen properly that Customer.CustomerID in Sub query....Yes, The following query returns all rows from Customer tableSelect * from customer where customer.CustomerID in (Select Customer.CustomerID from salesorder) --Chandu