Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions LAB_SQL_Basic_Queries.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
USE Sakila;
--- Display all available tables in the Sakila database.
SHOW TABLES FROM sakila;
--- Retrieve all the data from the tables actor, film and customer.
SELECT * FROM actor;
SELECT * FROM film;
SELECT * FROM customer;
SELECT title FROM film;
--- Retrieve the following columns from their respective tables:
SELECT name AS "language" FROM language;
SELECT first_name FROM staff;
SELECT distinct release_year FROM film;
SELECT COUNT(*) FROM store;
SELECT COUNT(*) staff_id FROM staff;
--- Films available to rent
SELECT COUNT(*) AS available_for_rent
FROM inventory;
--- Last names of Actors
SELECT COUNT(DISTINCT last_name) AS "Number_of_last_names"
FROM actor;
--- 10 longest films
SELECT length
FROM film
ORDER BY length DESC
LIMIT 10;
--- Retrieve all actors with the first name "SCARLETT"
SELECT *
FROM actor
WHERE first_name = "SCARLETT";
--- BONUS
SELECT *
FROM film
WHERE length > 100
AND title LIKE "%ARMAGEDDON%";