KeeJayBe

SQL examenvoorbeeld

Jan 6th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.92 KB | None | 0 0
  1. /* 1 */
  2. select sum(verkoopprijs) as 'totaal factuurbedrag'
  3. from factuurregel fr join factuur f on fr.factuurnr = f.factuurnr join klant k on k.klantnr = f.klantnr
  4. where provincie = 'ovl'
  5.  
  6. /* 2 */
  7. select count(artikelnr) as 'aantal artikelen', naam from artikel a, soort s where a.soortnr=s.soortnr group by 2 order by 1
  8.  
  9. /* 3 */
  10. select p.productgroepnr, productnaam, count(naam) as 'aantal soorten' from productgroep p, soort s where p.productgroepnr=s.productgroepnr group by 2
  11.  
  12. /* 4 */
  13. select naam, voorraad from soort s, artikel a where s.soortnr=a.soortnr and voorraad>100 group by naam
  14.  
  15. /* 5 */
  16. select naam, kleur, case
  17. when alcoholperc>=40 then 'heel sterk'
  18. when alcoholperc>=20 and alcoholperc<40 then 'redelijk sterk'
  19. else 'drinkbaar'
  20. end as sterkte
  21. from soort where kleur='Kleurloos'
  22.  
  23. /* 6a */
  24. update artikel set jaar=1900 where jaar is null
  25.  
  26. /* 6b */
  27. delete from artikel where jaar=1900 and soortnr=1210
Add Comment
Please, Sign In to add comment