安辰传奇一条龙,总裁的火爆甜心,彭小枫上将
首先,新建两张表a和b,然后插入6条数据到a表,3条数据到b表。语句如下:
create table a( id int identity(1,1) not null, aname nvarchar(300) null ) create table b( id int identity(1,1) not null, bid int not null, bname nvarchar(300) null ) insert into b(bname,bid) values(n'小明',2) insert into b(bname,bid) values(n'小网',1) insert into b(bname,bid) values(n'小刚',1) insert into b(bname,bid) values(n'小蒋',1) insert into b(bname,bid) values(n'小赵',1) insert into b(bname,bid) values(n'小流',1) insert into a(aname) values(n'一班') insert into a(aname) values(n'二班') insert into a(aname) values(n'三班')
执行语句[select * from a left join b on a.id=b.bid where b.bname=n'小明'],结果如下:
执行语句[select * from a left join b on a.id=b.bid and b.bname=n'小明'],结果如下:
写作时间:2017-11-8
=====================================================================================
本文只代表本人的见解,可能存在错误,仅用于技术交流。如果你喜欢该文,可以扫下面的二维码打赏我(打赏敬请备注“博客园打赏”五字)。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
数据库SQL---数据库、基本表、视图、索引的定义、修改、删除
在 Azure CentOS VM 中配置 SQL Server 2019 AG - (上)
在 Azure CentOS VM 中配置 SQL Server 2019 AG - (下)
网友评论