42 lines
1.3 KiB
SQL
42 lines
1.3 KiB
SQL
/*10.feladat*/
|
|
CREATE DATABASE hamburger CHARACTER SET="utf8" COLLATE="utf8_hungarian_ci";
|
|
|
|
/*12.feladat*/
|
|
SELECT * FROM menutetel
|
|
WHERE menutetel.ar = 2500;
|
|
|
|
/*13*/
|
|
UPDATE menutetel SET ar = 2300 WHERE nev LIKE "Grill pizza 32cm";
|
|
|
|
/*14*/
|
|
SELECT felhasznalo.nev as `vendeg_nev`,
|
|
COUNT(rendeles.id) AS `rendeles_db`
|
|
FROM rendeles
|
|
INNER JOIN felhasznalo ON felhasznalo.id = rendeles.felhasznaloId
|
|
GROUP BY felhasznalo.nev
|
|
ORDER BY `rendeles_db` DESC LIMIT 9;
|
|
|
|
/*15*/
|
|
INSERT INTO menutetel (nev, ar, etelkatId) VALUES ("Boston Tészta", 2200, 3);
|
|
|
|
/*16*/
|
|
|
|
SELECT rendeles.id as `rendeles_azon`,
|
|
rendeleselem.id as `rendeleselem_azon`,
|
|
menutetel.nev as `menutetel_neve`
|
|
FROM rendeles
|
|
INNER JOIN felhasznalo ON felhasznalo.id = rendeles.felhasznaloId
|
|
INNER JOIN rendeleselem ON rendeles.id = rendeleselem.rendelesId
|
|
INNER JOIN menutetel ON rendeleselem.menutetelId = menutetel.id
|
|
WHERE felhasznalo.nev LIKE "Balázs Flóra";
|
|
|
|
/*17*/
|
|
|
|
SELECT felhasznalo.nev as `felhasznalo_nev`,
|
|
SUM(menutetel.ar * rendeleselem.mennyiseg) * 1.1 as `osszesen`
|
|
FROM rendeleselem
|
|
INNER JOIN rendeles ON rendeleselem.rendelesId = rendeles.id
|
|
INNER JOIN felhasznalo ON rendeles.felhasznaloId = felhasznalo.id
|
|
INNER JOIN menutetel ON menutetel.id = rendeleselem.menutetelId
|
|
GROUP BY `felhasznalo_nev`
|
|
ORDER BY `osszesen` DESC LIMIT 10; |