Freddicola / sql_study

0 stars 0 forks source link

SQL:: group by #1

Open Freddicola opened 1 year ago

Freddicola commented 1 year ago

site: https://velog.io/@jen_jyseo/DataBase-%EA%B7%B8%EB%A3%B9%EC%A1%B0%ED%9A%8C

Freddicola commented 1 year ago

image

Freddicola commented 1 year ago

image image

Freddicola commented 1 year ago
select 
    rental.customer_id,
    customer.first_name,
    customer.last_name,
    count(rental.customer_id) as cnt_id
from 
    rental
inner join 
    customer 
    on rental.customer_id = customer.customer_id
group by 
    rental.customer_id, 
    customer.first_name, 
    customer.last_name
order by 
    cnt_id desc