“各种连接(等值连接、内连接、外连接、左连接、右连接、全连接)”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
第1行: 第1行:
等值连接/显式内连接
+
<syntaxhighlight lang="sql">
 +
CREATE TABLE `student` (
 +
  `sid` int(11) NOT NULL AUTO_INCREMENT,
 +
  `snum` int(11) NOT NULL,
 +
  `sname` varchar(20) NOT NULL,
 +
  `sage` tinyint(4) DEFAULT NULL,
 +
  `sclass` smallint(6) NOT NULL,
 +
  PRIMARY KEY (`snum`),
 +
  UNIQUE KEY `student_num` (`sid`)
 +
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
 
 +
</syntaxhighlight>等值连接/显式内连接
  
 
自然连接
 
自然连接

2022年11月3日 (四) 07:49的版本

CREATE TABLE `student` (
  `sid` int(11) NOT NULL AUTO_INCREMENT,
  `snum` int(11) NOT NULL,
  `sname` varchar(20) NOT NULL,
  `sage` tinyint(4) DEFAULT NULL,
  `sclass` smallint(6) NOT NULL,
  PRIMARY KEY (`snum`),
  UNIQUE KEY `student_num` (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

等值连接/显式内连接

自然连接

外连接

内连接

全连接