Advertisement
tampurus

Practical 9

Jun 6th, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.59 KB | None | 0 0
  1. 1 CREATE VIEW bigorders AS SELECT onum FROM orders_aj WHERE amount>= 4000;
  2.    
  3. VIEW created
  4.  
  5.  
  6. 2 CREATE VIEW ratecount(rating,rating_count) AS SELECT rating,COUNT(cnum) FROM customer_aj GROUP BY rating;
  7.    
  8. VIEW created
  9. -- how view looks
  10. RATING  RATING_COUNT
  11. 300      2
  12. 200      2
  13. 100      3
  14.  
  15. 3 CREATE VIEW demo (high_rating) AS SELECT MAX(rating) FROM customer_aj;
  16.  
  17. VIEW created
  18.  
  19. 4 CREATE VIEW demo_k (city,city_count) AS SELECT city,COUNT(snum) FROM salesman_aj GROUP BY city;
  20.  
  21. VIEW created
  22.  
  23. -- how view looks
  24. CITY    CITY_COUNT
  25. Surat       1
  26. Baroda      1
  27. NEW Delhi   1
  28. London      2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement