1.准备
1.1 脚本
create table tb4(id int,v1 int);
insert into tb4(id,v1) values(1,11);
insert into tb4(id,v1) values(2,12);
select * from tb4
1.2 运行结果
![]()
2.简单应用
2.1 脚本
with temptb4 as (select * from tb4)
select * from temptb4
2.2 运行结果
![]()
本文详细介绍了如何使用SQL创建表格、插入数据,并通过视图进行数据查询。首先,展示了创建一个包含id和v1字段的表格tb4,并插入两行数据。随后,演示了如何使用WITH语句创建临时视图temptb4,并从该视图中选择所有数据,展示了SQL在数据管理和查询方面的基本用法。
1.1 脚本
create table tb4(id int,v1 int);
insert into tb4(id,v1) values(1,11);
insert into tb4(id,v1) values(2,12);
select * from tb4
1.2 运行结果
![]()
2.1 脚本
with temptb4 as (select * from tb4)
select * from temptb4
2.2 运行结果
![]()
4424

被折叠的 条评论
为什么被折叠?