You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Q1) write a SQL query to find the salesperson and customer who reside in the same city. Return Salesman, cust_name and city.
SELECTs.nameAS Salesman1, c.cust_name, c.cityFROM Salesman1 s INNER JOIN Customer1 c ONs.city=c.city;
Q2) write a SQL query to find the salesperson(s) and the customer(s) he represents. Return Customer Name, city, Salesman, commission.
SELECTc.cust_nameAS Customer_Name, c.city, s.nameAS Salesman, s.commissionFROM Customer1 c INNER JOIN Salesman1 s ONc.salesman_id=s.salesman_id;
Q3) Write a SQL statement to make a Cartesian product between salesman and customer
SELECT*FROM Salesman1, Customer1;
Q4) Write a SQL statement to generate a list in ascending order of salespersons who work either for one or more customers or have not yet joined any of the customers.
SELECTs.nameAS Salesman FROM Salesman1 s LEFT JOIN Customer1 c ONs.salesman_id=c.salesman_idWHEREc.salesman_idIS NOT NULLORc.salesman_id IS NULLORDER BYs.nameASC;
Q5) Write a SQL query to find salespeople who received commissions of more than 10 percent from the company. Return Customer Name, customer city, Salesman, commission.
SELECTc.cust_nameAS Customer_Name, c.cityAS Customer_City, s.nameAS Salesman, s.commissionFROM Customer1 c JOIN Salesman1 s ONc.salesman_id=s.salesman_idWHEREs.commission>0.1ORDER BYs.nameASC;