Summary Files Commits Branches @commit @diff @stats
path: root / Year 3 / Databases / Practice01.sql
diff options
context:
space:
mode:
1 files changed, 41 insertions, 0 deletions
-rw-r--r--Year 3/Databases/Practice01.sql41
diff --git a/Year 3/Databases/Practice01.sql b/Year 3/Databases/Practice01.sql
new file mode 100644
index 0000000..dab5131
--- /dev/null
+++ b/Year 3/Databases/Practice01.sql
@@ -0,0 +1,41 @@
+-- MOVIES
+-- Ex 1
+select ADDRESS from STUDIO where NAME = "MGM";
+-- Ex 2
+select BIRTHDATE from MOVIESTAR where NAME = "Sandra Bullock";
+-- Ex 3
+select STARNAME from STARSIN where MOVIEYEAR = 1980 and MOVIETITLE LIKE "%Empire%";
+-- Ex 4
+select NAME from MOVIEEXEC where NETWORTH > 10000000;
+-- Ex 5
+select * from MOVIESTAR where GENDER = 'M' or ADDRESS = "Malibu";
+
+-- PC
+-- Ex 1
+select model, speed as "MHz", hd as "GB" from pc where price < 1200;
+-- Ex 2
+select model, (price / 1.1) as "euro price" from pc order by price asc;
+-- Ex 3
+select model, ram, screen from laptop where price > 1000;
+-- Ex 4
+select * from printer where color = "y";
+-- Ex 5
+select model, speed, hd from pc where (cd = "12x" or cd = "16x") and price < 2000;
+-- Ex 6
+select code, model, (speed + ram + 10 * screen) as rating from laptop;
+-- Ex 7
+select code, model, (speed + ram + 10 * screen) as rating from laptop order by rating desc, code asc;
+
+-- SHIPS
+-- Ex 1
+select CLASS, COUNTRY from CLASSES where NUMGUNS < 10;
+-- Ex 2
+select NAME as shipName from SHIPS where LAUNCHED < 1918;
+-- Ex 3
+select SHIP, BATTLE from OUTCOMES where RESULT = "sunk";
+-- Ex 4
+select NAME from SHIPS where NAME = CLASS;
+-- Ex 5
+select NAME from SHIPS where NAME like "R%";
+-- Ex 6
+select NAME from SHIPS where NAME like "% %" and NAME not like "% % %";