InterviewSolution
Saved Bookmarks
| 1. |
Consider the tables given below.SalespersonIdNameAgeSalary1Aiay611400002Sunil34440005Chris34400007Amaaya4152000 OrdersOrderIDSalespersonlDAmount10254000207180003014600040524000With reference to the above given tables, (is 86b) Write commands in SQL for (i) and (ii) and output for (iii) below :(i) To display SalespersonlD, names, orderids and order Amount of all salespersons.(ii) To display Names, salespersonslD and Order ID of those sales persons whose names start with A and sales amount is between 15000 and 20000.(iii) SELECT SalespersonlD, Name, Age, Amount FROM Salesperson, Orders WHERE Salesperson. SalespersonlD= Orders. SalespersonlD and Age between 30 and 45; |
|
Answer» (i) SELECT S.SalespersonlD, Name, OrderID, Amount FROM Salesperson S, Orders O WHERE S.SalespersonlD= O.SalespersonlD; (ii) SELECT Name, S.SalespersonlD, OrderID FROM Salesperson S, Orders O WHERE S. SalespersonlD=O. SalespersonlD AND Name LIKE "A%" AND Amount BETWEEN 15000 AND 20000; (iii) 2 Sunil 34 54000 5 Chris 34 24000, 7 Amaaya 41 18000 |
|