我想为儿童电影和不是儿童电影指望。这就是我所知道的 到目前为止。
这是为了显示表格中的是和否,是的是针对PG和G的儿童电影
select
category.name,film.title,film.rating,
if(
category.name='For_Kids'
or film.rating='PG'
or film.rating='G' ,"YES","NO"
) 'rating yes or no'
from
film
inner join film_category on film.film_id = film_category.film_id
inner join
category on film_category.category_id =category.category_id
order by film.title asc;
我想为孩子们看电影,但我坚持要为孩子们看其他电影。这是我到目前为止所知道的。
select
sum(if(film.rating='G'or film.rating='PG',1,0)) as totalkidsfilms
from
film
inner join film_category on film.film_id = film_category.film_id
inner join category on film_category.category_id =category.category_id
order by film.title asc;