Monday, February 11, 2019

SQL question challenge (Customer with no orders)

SQL Challenge
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything.

Table: Customer.

| Id | Name  |   
| 1  | Joe   |
| 2  | Henry |
| 3  | Sam   |
| 4  | Max   |

Using the above tables as example, return the following:

| Customers |
| Henry     |
| Max       |


create table customer (id int,name varchar(100))
insert into customer values(1,'Joe');
insert into customer values(2,'Henry');
insert into customer values(3,'Sam');
insert into customer values(4,'Max');

create table orders(id int,customer_id int);
insert into orders values(1,3);
insert into orders values(3,1);


select from customer cust
 left join orders ord on
 where is null;


  1. any case, it additionally implies more open doors for the business to demonstrate significant elements like shopper conduct, taking into account increasingly exact perspectives on circumstances and dangers. ExcelR Data Science Courses

  2. Very nice blogs!!! i have to learning for lot of information for this sites…Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing, data sciecne course in hyderabad

  3. Incredibly in general very intriguing post. I was looking for such an information and took pleasure in scrutinizing this one. Keep posting. An obligation of appreciation is all together for analytics course in Hyderabad