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
41 changes: 41 additions & 0 deletions SQL_Basic_Queries.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
USE SAKILA;
SHOW TABLES;

SELECT * FROM actor;
SELECT * FROM film;
SELECT * FROM customer;

SELECT title FROM film;
SELECT name AS language FROM language;
SELECT first_name FROM staff;

SELECT DISTINCT release_year FROM film;

SELECT COUNT(*) AS store_count FROM store;
SELECT COUNT(*) AS employee_count FROM staff;

SELECT COUNT(*) AS available_films
FROM inventory
WHERE inventory_id NOT IN (
SELECT inventory_id FROM rental
);
SELECT COUNT(DISTINCT inventory_id) AS rented_films
FROM rental;

SELECT COUNT(DISTINCT last_name) AS distinct_last_names
FROM actor;

SELECT title, length
FROM film
ORDER BY length DESC
LIMIT 10;

SELECT * FROM actor
WHERE first_name = 'SCARLETT';

SELECT * FROM film
WHERE title LIKE '%ARMAGEDDON%' AND length > 100;

SELECT COUNT(*) AS behind_the_scenes_count
FROM film
WHERE CONCAT(',', LOWER(special_features), ',') LIKE '%,behind the scenes,%';