mysql练习----More JOIN operations
This tutorial introduces the notion of a join. The database consists of three tables movie , actor and casting .
|
movie |
actor | casting |
|---|---|---|
| id | id | movieid |
| title | name | actorid |
| yr | ord | |
| director | ||
| budget | ||
| gross | ||

movie
| Field name | Type | Notes |
|---|---|---|
| id | INTEGER | An arbitrary unique identifier |
| title | CHAR(70) | The name of the film - usually in the language of the first release. |
| yr | DECIMAL(4) | Year of first release. |
| director | INT | A reference to the actor table. |
| budget | INTEGER | How much the movie cost to make (in a variety of currencies unfortunately). |
| gross | INTEGER | How much the movie made at the box office. |
Example
| id | title | yr | director | budget | gross |
|---|---|---|---|---|---|
| 10003 | "Crocodile" Dundee II | 1988 | 38 | 15800000 | 239606210 |
| 10004 | 'Til There Was You | 1997 | 49 | 10000000 |
actor
| Field name | Type | Notes |
|---|---|---|
| id | INTEGER | An arbitrary unique identifier |
| name | CHAR(36) | The name of the actor (the term actor is used to refer to both male and female thesps.) |
Example
| id | name |
|---|---|
| 20 | Paul Hogan |
| 50 | Jeanne Tripplehorn |
casting
| Field name | Type | Notes |
|---|---|---|
| movieid | INTEGER | A reference to the movie table. |
| actorid | INTEGER | A reference to the actor table. |
| ord | INTEGER | The ordinal position of the actor in the cast list. The
star of the movie will have ord value 1 the co-star will have value 2, ... |
Example
| movieid | actorid | ord |
|---|---|---|
| 10003 | 20 | 4 |
| 10004 | 50 | 1 |















mysql练习----More JOIN operations的更多相关文章
- MySQL关联left join 条件on与where不同
以下的文章主要讲述的是MySQL关联left join 条件on与where 条件的不同之处,我们现在有两个表,即商品表(products)与sales_detail(销售记录表).我们主要是通过这两 ...
- MySQL 的各种 join
table th:first-of-type { width: 200px; } join 类型 备注 left [outer] join right [outer] join union [all ...
- MySQL之LEFT JOIN中使用ON和WHRERE对表数据
背景 left join在我们使用mysql查询的过程中可谓非常常见,比如博客里一篇文章有多少条评论.商城里一个货物有多少评论.一条评论有多少个赞等等.但是由于对join.on.where等关键字的不 ...
- 记录一下使用MySQL的left join时,遇到的坑
# 现象 left join在我们使用mysql查询的过程中可谓非常常见,比如博客里一篇文章有多少条评论.商城里一个货物有多少评论.一条评论有多少个赞等等.但是由于对join.on.where等关键字 ...
- MySQL 通过semi join 优化子查询
半连接是MySQL 5.6.5引入的,多在子查询exists中使用,对外部row source的每个键值,查找到内部row source匹配的第一个键值后就返回,如果找到就不用再查找内部row sou ...
- MySQL的left join中on与where的区别
关于 “A LEFT JOIN B ON 条件表达式” 的一点提醒 ON 条件(“A LEFT JOIN B ON 条件表达式”中的ON)用来决定如何从 B 表中检索数据行,即使on中包含有A表中的列 ...
- mysql left( right ) join使用on 与where 筛选的差异
有这样的一个问题mysql查询使用mysql中left(right)join筛选条件在on与where查询出的数据是否有差异. 可能只看着两个关键字看不出任何的问题.那我们使用实际的例子来说到底有没有 ...
- mysql 跨库JOIN
现有两台MYSQL数据库 一台是192.168.1.1 端口3306 上有数据库DB1 有表TABLE1一台是192.168.1.2 端口3307 上有数据库DB2 有表TABLE2192.168.1 ...
- mysql关键字讲解(join 、order by、group by、having、distinct)
1.join 1.1 OUTER JOIN:想要包含右侧表中的所有行,以及左侧表中有匹配记录的行. 1.11 Mysql中有左连接(left join): ...
随机推荐
- OpenResty api网关设计
本文讲述 OpenResty api网关设计,主要涉及api网关介绍.openresty api网关 请求路由(路由判断.路由重写.服务判断.限流).授权验证(统一认证).动态Upstream 以及这 ...
- 敏感词汇过滤DFA算法
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Tex ...
- 基于python的图片修复程序-可用于水印去除
图片修复程序-可用于水印去除 在现实的生活中,我们可能会遇到一些美好的或是珍贵的图片被噪声干扰,比如旧照片的折痕,比如镜头上的灰尘或污渍,更或者是某些我们想为我所用但有讨厌水印,那么有没有一种办法可以 ...
- 【SqlServer系列】远程访问
1 概述 已发布[SqlServer系列]文章如下: [SqlServer系列]SQLSERVER安装教程 [SqlServer系列]数据库三大范式 [SqlServer系列]表单查询 [SqlS ...
- 翻译:SELECT INTO语句(已提交到MariaDB官方手册)
本文为mariadb官方手册:SELECT INTO的译文. 原文:https://mariadb.com/kb/en/selectinto/我提交到MariaDB官方手册的译文:https://ma ...
- SPI 方式初始化 SD 卡总流程图(V2.0)
- iOS 快速排序
一.快速排序概念及其思想 快速排序(QuickSort),又称为交换排序,是分治算法的一种,快速排序采用分治的策略. 1.分治法的基本思想: 将原问题分解为若干个规模更小但结构和原问题相似的子问题.递 ...
- 在Fragment中保存WebView状态
http://www.lucazanini.eu/2013/android/how-to-save-the-state-of-a-webview-inside-a-fragment-of-an-act ...
- [转]Virtualbox主机和虚拟机之间文件夹共享及双向拷贝(Windows<->Windows, Windows<->Linux)
本文转自:https://www.jb51.net/article/97271.htm 最近学习Virtualbox的一些知识,记录下,Virtualbox下如何实现主机和虚拟机之间文件夹共享及双向拷 ...
- Android Studio 新建项目结构分析
这是我刚刚新建的项目 默认都是Android模式的项目结构,但这并不是真实的目录结构 把他换成Project模式 项目的真实目录结构 1app 项目的代码,资源 2 gradle wrappere ...