12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
本教程操作环境:windows7系统、mysql8版本、Dell G3电脑。创建两个表CREATETABLE`object_a`(`id`bigint(20)NOTNULLAUTO_INCREMENT,`oname`varchar(50)DEFAULTNULL,`odesc`va
以下为本文的正文内容,请查阅,本站为公益性网站,复制本文以及下载DOC文档全部免费。
本教程操作环境:windows7系统、mysql8版本、Dell G3电脑。
创建两个表
CREATETABLE`object_a`(`id`bigint(20)NOTNULLAUTO_INCREMENT,`oname`varchar(50)DEFAULTNULL,`odesc`varchar(50)DEFAULTNULL,`create_time`datetimeDEFAULTNULL,PRIMARYKEY(`id`))ENGINE=InnoDBAUTO_INCREMENT=4DEFAULTCHARSET=latin1
添加数据
CREATETABLE`object_b`(`id`bigint(20)NOTNULLAUTO_INCREMENT,`oname`varchar(50)DEFAULTNULL,`odesc`varchar(50)DEFAULTNULL,`create_time`datetimeDEFAULTNULL,PRIMARYKEY(`id`))ENGINE=InnoDBAUTO_INCREMENT=4DEFAULTCHARSET=latin1
添加数据
查询交集
SELECTa.oname,a.odescFROMobject_aaINNERJOINobject_bbONa.oname=b.onameANDa.odesc=b.odesc
等价于
SELECTa.oname,a.odescFROMobject_aaINNERJOINobject_bbUSING(oname,odesc)
结果如下
PS:别的数据库可以试试这种写法
SELECToname,odescFROMobject_aINTERSECTSELECToname,odescFROMobject_b
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19
11-19