-- 10. feladat:
CREATE DATABASE hamburger CHARACTER SET="utf8" COLLATE="utf8_hungarian_ci";


-- 12. feladat:
SELECT * FROM `menutetel` WHERE menutetel.ar = 2500;


-- 13. feladat:
UPDATE `menutetel` SET `ar`= 2300 WHERE menutetel.nev = "Grill pizza 32cm";


-- 14. feladat:
SELECT felhasznalo.nev AS `vendeg_nev`, COUNT(rendeles.felhasznaloId) AS `rendeles_db` FROM `rendeles` INNER JOIN felhasznalo ON rendeles.felhasznaloId = felhasznalo.id GROUP BY rendeles.felhasznaloId ORDER BY `rendeles_db` DESC LIMIT 9;


-- 15. feladat:
INSERT INTO `menutetel`(`nev`, `ar`, `etelkatId`) VALUES ("Boston tészta", 2300, 3);


-- 16. feladat:
SELECT rendeles.id AS `rendeles_azon`, rendeleselem.id AS `rendeleselem_azon`, menutetel.nev AS `menutetel_neve` FROM `rendeleselem` INNER JOIN rendeles ON rendeleselem.rendelesId = rendeles.id INNER JOIN felhasznalo ON rendeles.felhasznaloId = felhasznalo.id INNER JOIN menutetel ON rendeleselem.menutetelId = menutetel.id WHERE felhasznalo.nev = "Balázs Flóra";


-- 17. feladat:
SELECT felhasznalo.nev, SUM(rendeleselem.mennyiseg * menutetel.ar) * 1.10 AS `osszesen` FROM `rendeleselem` INNER JOIN rendeles ON rendeleselem.rendelesId = rendeles.id INNER JOIN felhasznalo ON rendeles.felhasznaloId = felhasznalo.id INNER JOIN menutetel ON rendeleselem.menutetelId = menutetel.id GROUP BY rendeles.felhasznaloId ORDER BY `osszesen` DESC LIMIT 1;

