-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathodev7.sql
27 lines (17 loc) · 888 Bytes
/
odev7.sql
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
-- 1. film tablosunda bulunan filmleri rating değerlerine göre gruplayınız.
SELECT rating FROM film
GROUP BY rating;
-- 2. film tablosunda bulunan filmleri replacement_cost sütununa göre grupladığımızda
-- film sayısı 50 den fazla olan replacement_cost değerini ve karşılık gelen film sayısını sıralayınız.
SELECT replacement_cost, COUNT(*) FROM film
GROUP BY replacement_cost
HAVING count(film) > 50;
-- 3.customer tablosunda bulunan store_id değerlerine karşılık gelen müşteri sayılarını nelerdir?
SELECT store_id, COUNT(*) FROM customer
GROUP BY store_id;
-- 4.city tablosunda bulunan şehir verilerini country_id sütununa göre gruplandırdıktan sonra
-- en fazla şehir sayısı barındıran country_id bilgisini ve şehir sayısını paylaşınız.
SELECT country_id, COUNT(*) FROM city
GROUP BY country_id
ORDER BY COUNT(*) DESC
LIMIT 1;