Advertisement
tampurus

Practical 3

May 13th, 2022 (edited)
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.44 KB | None | 0 0
  1. 1 SELECT sname,commision FROM salesman_aj;
  2.  
  3. SNAME   COMMISION
  4. Piyush  12
  5. Sejal   13
  6. Miti    11
  7. Rajesh  15
  8. Anand   10
  9.  
  10. 2 SELECT 'for'AS " ",odate AS " " ,'there is' AS " " ,COUNT(onum) AS " " ,'orders' AS " " FROM orders_aj
  11. GROUP BY odate ORDER BY COUNT(onum) DESC;
  12.                  
  13. FOR 10-MAR-97   there IS    5   orders
  14. FOR 10-JUN-97   there IS    2   orders
  15. FOR 10-APR-97   there IS    2   orders
  16. FOR 10-MAY-97   there IS    1   orders
  17.  
  18. 3 SELECT onum,snum,amount*(12/100) AS "amount for 12 % commission" FROM orders_aj;
  19.  
  20. ONUM    SNUM    amount FOR 12 % commission
  21. 3011    1001    1187.0256
  22. 3010    1002    157.194
  23. 3008    1001    566.76
  24. 3007    1002    9.09
  25. 3009    1003    205.5876
  26. 3006    1007    131.7792
  27. 3005    1002    619.254
  28. 3002    1004    228.012
  29. 3003    1001    92.0628
  30. 3001    1007    2.2428
  31.  
  32. 4 SELECT 'for' AS " ",'the' AS " " , city AS " ",'highest rating is ' AS " "  , MAX(rating) AS " " FROM customer_aj GROUP BY city;
  33.                  
  34. FOR the Rome    highest rating IS   200
  35. FOR the Surat   highest rating IS   300
  36. FOR the London  highest rating IS   100
  37. FOR the Bombay  highest rating IS   300
  38.  
  39. 5 SELECT * FROM customer_aj ORDER BY rating DESC;
  40.  
  41. CNUM    CNAME   CITY    RATING  SNUM
  42. 2004    Govind  Bombay  300 1002
  43. 2008    Chinmay Surat   300 1007
  44. 2003    Lalit   Surat   200 1002
  45. 2002    Gita    Rome    200 1003
  46. 2006    Chirag  London  100 1001
  47. 2001    Harsh   London  100 1001
  48. 2007    Pratik  Rome    100 1004
  49.  
  50. 6 SELECT odate,SUM(amount) FROM orders_aj GROUP BY odate ORDER BY odate DESC;
  51.  
  52. ODATE   SUM(AMOUNT)
  53. 10-JUN-97   11201.83
  54. 10-MAY-97   4723
  55. 10-APR-97   1788.98
  56. 10-MAR-97   8944.59
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement