码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • SQLZOO 7 More JOIN


    More JOIN

            • 1.List the films where the yr is 1962 [Show id, title]
            • 2.Give year of 'Citizen Kane'.
            • 3.List all of the Star Trek movies, include the id, title and yr (all of these movies include the words Star Trek in the title). Order results by year.
            • 4.What id number does the actor 'Glenn Close' have?
            • 5.What is the id of the film 'Casablanca'.
            • 6.Obtain the cast list for 'Casablanca'.
            • 7.Obtain the cast list for the film 'Alien'
            • 8.List the films in which 'Harrison Ford' has appeared
            • 9.List the films where 'Harrison Ford' has appeared - but not in the starring role. [Note: the ord field of casting gives the position of the actor. If ord=1 then this actor is in the starring role]
            • 10.List the films together with the leading star for all 1962 films.
            • 11.Which were the busiest years for 'Rock Hudson', show the year and the number of movies he made each year for any year in which he made more than 2 movies.

    1.List the films where the yr is 1962 [Show id, title]

    列出年份为1962年的电影[Show id, title]

    select id,title from movie where yr = '1962'
    
    • 1
    2.Give year of ‘Citizen Kane’.

    查询出电影’Citizen Kane’的上映年份

    select yr from movie where title = 'Citizen Kane'
    
    • 1
    3.List all of the Star Trek movies, include the id, title and yr (all of these movies include the words Star Trek in the title). Order results by year.

    列出所有星际旅行电影,包括id,title,yr(所有的星际旅行电影名都包含Star Trek字符串),将结果按照年份排序

    select id,title,yr from movie
    where title like '%Star Trek%' order by yr
    
    • 1
    • 2
    4.What id number does the actor ‘Glenn Close’ have?

    演员 'Glenn Close’的id是多少

    select id from actor where name='Glenn Close'
    
    • 1
    5.What is the id of the film ‘Casablanca’.

    电影 'Casablanca’的id是多少

    select id from movie where title like 'Casablanca'
    
    • 1
    6.Obtain the cast list for ‘Casablanca’.

    获取电影’Casablanca’的演员名单

    select name from actor
    join casting on actorid = id 
    where movieid = (select id from movie where title = 'Casablanca')
    
    • 1
    • 2
    • 3
    7.Obtain the cast list for the film ‘Alien’

    获取电影’Alien’的演员名单

    select name from actor 
    join casting on actorid=id 
    where movieid = (select id from movie where title = 'Alien')
    
    • 1
    • 2
    • 3
    8.List the films in which ‘Harrison Ford’ has appeared

    列出’Harrison Ford’出演过的电影

    select title from movie
    join casting on movieid = id 
    where actorid = (select id from actor where name = 'Harrison Ford')
    
    • 1
    • 2
    • 3
    9.List the films where ‘Harrison Ford’ has appeared - but not in the starring role. [Note: the ord field of casting gives the position of the actor. If ord=1 then this actor is in the starring role]

    列出’Harrison Ford’ 出演过的电影,但不要是主演。[注意:actor表的ord字段给出了演员的位置。如果ord=1,则该演员为主演]

    select title from movie join casting on movieid=id
    where actorid = 
    (select id from actor where name = 'Harrison Ford') and ord <> 1
    
    • 1
    • 2
    • 3
    10.List the films together with the leading star for all 1962 films.

    列出1962年所有电影的电影和主演

    select title,name from movie
    join casting on movieid = movie.id 
    join actor on actor.id = actorid 
    where ord=1 and yr = 1962
    
    • 1
    • 2
    • 3
    • 4
    11.Which were the busiest years for ‘Rock Hudson’, show the year and the number of movies he made each year for any year in which he made more than 2 movies.

    哪一年是“洛克·哈德森”最繁忙的年份,展示这一年以及他每年制作的电影数量,如果他制作的电影超过2部

    select yr,count(title) from movie
    join casting on movieid = movie.id
    join actor on actorid = actor.id
    where casting.actorid = 
    (select id from actor where name = 'Rock Hudson')
    group by yr having count(title) > 2
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
  • 相关阅读:
    kubernetes-helm
    Mac下使用Homebrew安装MySQL5.7
    从零搭建react+ts组件库(封装antd)
    我的创作纪念日
    重新整理 .net core 实践篇 ———— linux上排查问题 [外篇]
    地图轨迹跟踪系统设计与实现(Android+Eclipse+APP)
    物联网IOT发展智慧农业 助力乡村振兴
    【Python脚本进阶】2.1、端口扫描器(上):TCP全连接扫描
    两个多项式相加(顺序表&&链表)
    有用的内置Node.js APIs
  • 原文地址:https://blog.csdn.net/m0_53658634/article/details/126428187
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号