-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMySQL-Exercise.sql
More file actions
56 lines (56 loc) · 1.3 KB
/
MySQL-Exercise.sql
File metadata and controls
56 lines (56 loc) · 1.3 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
-- Question 1
select* from Sakila.actor;
-- Question 2
Select*From Actor
Where first_name = 'John';
-- Question 3
Select*from actor
Where last_name = 'Neeson';
-- Question 4
select*from actor
where actor_id %10=0;
-- Question 5
Select*From Sakila.film
where film_id= 100;
-- Question 6
Select*From sakila.film
where rating = 'r';
-- Question 7
Select*from sakila.film
where rating <> 'r';
-- Question 8
Select*from sakila.film
Order by length
limit 10;
-- Question 9
Select title from sakila.film
order by length
limit 10;
-- Question 10
Select*from sakila.film
where special_features= 'Deleted Scenes';
-- Question 11
Select distinct country from sakila.country;
-- Question 12
select * from sakila.language
order by name ASC;
-- Question13
SELECT `actor_id`, COUNT(*)
FROM `sakila`.`actor_info`
GROUP BY `actor_id`
ORDER BY COUNT(*) DESC;
SELECT*FROM `sakila`. `actor` WHERE `actor_id` =107;
-- Question 14
SELECT AVG(length) FROM `sakila`.`film`;
-- Question15
SELECT AVG(length), `rating` FROM `sakila`.`film` GROUP BY `rating`;
-- Question16
SELECT COUNT(`description`) FROM `sakila`. `film`
WHERE `description` LIKE '%robot%';
-- Qeustion18
SELECT*FROM film
WHERE YEAR(release_year)=2010;
-- Question19
SELECT `last_name`, COUNT(`last_name`) AS `actors_num`
FROM `sakila`.`actor`
GROUP BY `last_name`;