嫉妒別人,不会给自己增加任何的好处。嫉妒別人,也不可能减少別人的成就
create database scort
use scort
create table emp
(
empno int primary key,
ename nvarchar(10),
sal int,
deptno int
)
insert into emp values (7369,'smith',3000,20);
insert into emp values (7499,'allen',1500,50);
insert into emp values (7566,'jones',2000,30);
insert into emp values (7654,'martin',5000,10);
insert into emp values (7698,'blake',1800,30);
create table dept
(
deptno int primary key,
dname nvarchar(10),
loc nvarchar(10)
)
insert into dept values (10,'accounting','new york');
insert into dept values (20,'research','dallas');
insert into dept values (30,'sales','chicago');
insert into dept values (40,'operations','boston');
create table salgrade
(
grade int primary key,
lostl int,
hisal int
)
insert into salgrade values (1,700,1200);
insert into salgrade values (2,1201,1400);
insert into salgrade values (3,1401,2000);
insert into salgrade values (4,2001,3000);
insert into salgrade values (5,3001,6000);
结果集中包含三部分内容:
实例演示:
两张表连接:
select * from emp
full join dept
on emp.deptno=dept.deptno
三张表连接:
select * from emp "E"
full join dept "D"
on "E".deptno="D".deptno
full join salgrade "S"
on "E".sal>"S".lostl and "E".sal<"S".hisal
本篇博客来自于郝斌老师视频教程的总结以及笔记的整理,仅供学习交流,切勿用于商业用途,如有侵权,请联系博主删除,博主QQ:194760901