diff --git a/Extension 1.sql b/Extension 1.sql new file mode 100644 index 0000000..e69de29 diff --git a/Extension 1.sql.tag b/Extension 1.sql.tag new file mode 100644 index 0000000..e69de29 diff --git a/Extension 2.sql b/Extension 2.sql new file mode 100644 index 0000000..e69de29 diff --git a/Extension 2.sql.tag b/Extension 2.sql.tag new file mode 100644 index 0000000..e69de29 diff --git a/Extension 3.sql b/Extension 3.sql new file mode 100644 index 0000000..5606ecd --- /dev/null +++ b/Extension 3.sql @@ -0,0 +1,4 @@ +SELECT ARRAY[CONCAT(name, ':', CAST(COUNT(name) AS CHAR))] from films_ext f +INNER JOIN directors d +ON f.directorId = d.id +GROUP BY d.name, f.title; \ No newline at end of file diff --git a/Extension 3.sql.tag b/Extension 3.sql.tag new file mode 100644 index 0000000..e69de29 diff --git a/Standard Criteria 2.sql b/Standard Criteria 2.sql new file mode 100644 index 0000000..f46cd2f --- /dev/null +++ b/Standard Criteria 2.sql @@ -0,0 +1,49 @@ + +SELECT * FROM films; + + +SELECT * FROM films +ORDER BY (score) DESC; + + + +SELECT * FROM films +ORDER BY (release_year) DESC; + + +SELECT * FROM films +WHERE (score) >= 8; + +SELECT * FROM films +WHERE (score) <= 7; + + +SELECT * FROM films +WHERE (release_year) = 1990; + +SELECT * FROM films +WHERE (release_year) < 2000; + +SELECT * FROM films +WHERE (release_year) > 1990; + +SELECT * FROM films +WHERE (release_year) > 1990 AND (release_year) < 1999; + +SELECT * FROM films +WHERE (genre) = 'SciFi'; + +SELECT * FROM films +WHERE (genre) = 'SciFi' OR (genre) = 'Western'; + + +SELECT * FROM films +WHERE NOT (genre) = 'SciFi'; + +SELECT * FROM films +WHERE (genre) = 'Western' AND (release_year) < 2000; + +SELECT * FROM films +WHERE (title) LIKE '%Matrix%'; + + diff --git a/Standard Criteria 2.sql.tag b/Standard Criteria 2.sql.tag new file mode 100644 index 0000000..e69de29 diff --git a/Standard Criteria.sql b/Standard Criteria.sql new file mode 100644 index 0000000..dfe73c5 --- /dev/null +++ b/Standard Criteria.sql @@ -0,0 +1,27 @@ +CREATE TABLE films ( +id SERIAL, +title VARCHAR (50) UNIQUE, +genre VARCHAR(30), +release_year INT, +score INT, +PRIMARY KEY (id) +); + +INSERT INTO FILMS (title, genre, release_year, score) +VALUES +('The Shawshank Redemption', 'Drama', 1994, 9), +('The Godfather', 'Crime', 1972, 9), +('The Dark Knight', 'Action', 2008, 9), +('Alien', 'SciFi', 1979, 9), +('Total Recall', 'SciFi', 1990, 8), +('The Matrix', 'SciFi', 1999, 8), +('The Matrix Resurrections', 'SciFi', 2021, 5), +('The Matrix Reloaded', 'SciFi', 2003, 6), +('The Hunt for Red October', 'Thriller', 1990, 7), +('Misery', 'Thriller', 1990, 7), +('The Power Of The Dog', 'Western', 2021, 6), +('Hell or High Water', 'Western', 2016, 8), +('The Good the Bad and the Ugly', 'Western', 1966, 9), +('Unforgiven', 'Western', 1992, 7); + + diff --git a/Standard Criteria.sql.tag b/Standard Criteria.sql.tag new file mode 100644 index 0000000..e69de29