-
Notifications
You must be signed in to change notification settings - Fork 877
Expand file tree
/
Copy pathlab-sql-basic-queries-julian.sql
More file actions
89 lines (64 loc) · 1.07 KB
/
lab-sql-basic-queries-julian.sql
File metadata and controls
89 lines (64 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
USE sakila;
-- check if Db loaded correctly
SELECT COUNT(*) FROM actor;
SELECT COUNT(*) FROM film;
SELECT COUNT(*) FROM customer;
-- view Db
SELECT * FROM actor;
SELECT * FROM film;
SELECT * FROM customer;
-- question 3: load colums
select title
from film
;
select distinct name as language
from language
;
select first_name
from staff
;
-- question 4
select distinct release_year
from film
;
-- question 5
select count(*) as n_stores
from store
;
select count(*) as n_staff
from staff
;
-- films available to rent
select count(distinct film_id) as n_film
from film
;
-- films rented
select count(distinct rental_id) as films_rented
from rental
;
select distinct count(last_name)
from actor
;
-- question 6
select title, release_year, length
from film
order by length desc
limit 10
;
-- question 7
select *
from actor
where first_name = "SCARLETT"
;
-- bonus 7.2
select film_id, title, length
from film
where title like "%ARMAGEDDON%"
AND
length > 100
;
-- 7.3
select count(*) as film_BS_Content
from film
where special_features like "%BEHIND the Scenes%"
;