# Cross Join Joe 需要生成 goods 表 ```mysql create table goods( id int primary key auto_increment, category varchar(64), name varchar(256), price decimal(12, 4), stock int, upper_time timestamp ) ``` 中所有T恤(category为`T-Shirt`)的所有尺寸,尺寸信息在 size 表 ```mysql create table size( id int primary key auto_increment, name varchar(16) ) ``` 中,那么这个查询应该是:
点击进入[MySQL实战练习环境](https://mydev.csdn.net/product/pod/new?image=cimg-centos7-skilltreemysql&connect=auto&create=auto&utm_source=skill)。 * `show databases` 列出所有数据库 * `show tables` 列出所有表 ## 答案 ```mysql select g.id, g.name, s.name as size from goods as g cross join size as s where g.category = 'T-Shirt'; ``` ## 选项 ### A ```mysql select g.id, g.name, s.name as size from goods as g full join size as s where g.category = 'T-Shirt'; ``` ### B ```mysql select g.id, g.name, s.name as size from goods as g left join size as s where g.category = 'T-Shirt'; ``` ### C ```mysql select g.id, g.name, s.name as size from goods as g left join size as s where g.category = 'T-Shirt'; ``` ### D ```mysql select g.id, g.name, s.name as size from goods as g right join size as s where g.category = 'T-Shirt'; ``` ### E ```mysql select g.id, g.name, s.name as size from goods as g outter join size as s where g.category = 'T-Shirt'; ```