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
68 changes: 68 additions & 0 deletions basic_queries.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
-- 1. Display all available tables in the Sakila database.
USE sakils;

show tables;

-- 2. Retrieve all the data from the tables actor, film and customer.

select *
from actor;

select *
from film;

select *
from customer;

-- 3. Retrieve the following columns from their respective tables:

select title
from film;

select name as "language"
from language;

select first_name
from staff;

-- 4. Retrieve unique release years.
select distinct(release_year)
from film;

-- 5. Counting records for database insights:
select count(store_id)
from store;

select count(staff_id)
from staff;

select count(inventory_id), count(rental_id)
from rental;

select count(distinct(last_name))
from actor;

-- 6. Retrieve the 10 longest films.

select length, title
from film
order by length desc
limit 10;

-- 7. Use filtering techniques in order to:

select first_name
from actor
where first_name = "SCARLETT";

select title
from film
where title like "%ARMAGEDDON%" and length > 100;

select special_features, title
from film
where special_features like "%Behind the Scenes%";