执行SQL分析数据

本节我们将执行一些简单的SQL查询对电影数据进行分析

查询表中数据总量:

select count(*) from imdb.title;
select count(*) from imdb.title_basics;

image-20221026193225634

统计电影的语言列表:

select distinct language from imdb.title order by language;

image-20221026193256466

统计最大、最小、平均时长:

select max(runtimeminutes), min(runtimeminutes), avg(runtimeminutes), count(*) from imdb.title_basics;

执行join查询:

select
       title.title,
       title.language,
       title_basics.primarytitle,
       title_basics.startyear,
       title_basics.genres
from imdb.title
  join imdb.title_basics on title.titleid = title_basics.tconst
where title.language = 'en' limit 100;

image-20221026193349444