这是啥意思?

shiguangxin 2003-12-01 05:27:57
create table tb(id int identity(1,1) not null constraint PK_tb primary key clustered ,pid int,name varchar(20))

----------以下内容看不懂
insert into tb
select 0,'中国'
union all select 0,'美国'
union all select 0,'加拿大'
union all select 1,'北京'
union all select 1,'上海'
union all select 1,'江苏'
union all select 6,'苏州'
union all select 7,'常熟'
union all select 6,'南京'
union all select 6,'无锡'
union all select 2,'纽约'
union all select 2,'旧金山'
go

谁能给俺解释一下??
...全文
25 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
shiguangxin 2003-12-01
  • 打赏
  • 举报
回复
union all 能具体说一下吗?? thanks
伍子V5 2003-12-01
  • 打赏
  • 举报
回复
往tb表里插入以下集合
0,'中国'
0,'美国'
0,'加拿大'
1,'北京'
1,'上海'
.
.
.
txlicenhe 2003-12-01
  • 打赏
  • 举报
回复
insert into tb
select 0,'中国'
union all select 0,'美国'
union all select 0,'加拿大'
union all select 1,'北京'
union all select 1,'上海'
union all select 1,'江苏'
union all select 6,'苏州'
union all select 7,'常熟'
union all select 6,'南京'
union all select 6,'无锡'
union all select 2,'纽约'
union all select 2,'旧金山'

相当于
insert into tb(pid,name) values(0,'中国')
insert into tb(pid,name) values(0,'美国')
insert into tb(pid,name) values(0,'加拿大')
insert into tb(pid,name) values(1,'北京')
...

34,575

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧