社区
MS-SQL Server
帖子详情
高分求购一句sql语句
lonelybird818
2006-01-06 05:10:03
现在有三个表:
table1 字段:
libplace|description
值:
1|文科图书馆
2|理科图书馆
table2 字段:
gateno|libplace
值:
01|1
02|1
03|2
table3 字段:
name|gateno
值:
张三|01
李四|02
王五|03
要求:
在table3中,查询name,条件:文科图书馆
(sql语句,非存储过程)
...全文
80
3
打赏
收藏
高分求购一句sql语句
现在有三个表: table1 字段: libplace|description 值: 1|文科图书馆 2|理科图书馆 table2 字段: gateno|libplace 值: 01|1 02|1 03|2 table3 字段: name|gateno 值: 张三|01 李四|02 王五|03 要求: 在table3中,查询name,条件:文科图书馆 (sql语句,非存储过程)
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
brooks105
2006-01-06
打赏
举报
回复
create table table1
(libplace int,description char(20))
insert table1
select 1,'文科图书馆'
union all
select 2,'理科图书馆'
create table table2
(gateno char(5),libplace int)
insert table2
select '01',1
union all
select '02',1
union all
select '03',2
create table table3
(name char(10),gateno char(5))
insert table3
select '张三','01'
union all
select '李四','02'
union all
select '王五','03'
select a.name from table3 a
join table2 b on a.gateno=b.gateno
join table1 c on b.libplace=c.libplace
where c.description = '文科图书馆'
name
----------
张三
李四
(所影响的行数为 2 行)
子陌红尘
2006-01-06
打赏
举报
回复
select c.name from table1 a inner join table2 b on a.libplace=b.libplace inner join table3 c on b.gateno=c.gateno where a.description='文科图书馆'
pbsql
2006-01-06
打赏
举报
回复
select table3.name
from table1,table2,table3
where table1.libplace=table2.libplace
and table2.gateno=table3.gateno
and table1.[description]='文科图书馆'
软考高项论文50分秘籍——心法篇
讲师以52分和53分通过论文,2次
高分
通过,方法论经得起考验
一条
sql语句
查出男生前5名和女生前五名
表t_stu;其中三个字段:name,gender,grade;要求用一条
sql语句
查出男生前5名和女生前五名 select * from t_stu a where 5>(select count(*) FROM t_stu where gender=a.gender AND grade>a.grade) order by a.grade desc 对这个sql的理解是 对于每
【②MySQL 】:测试数据准备、
SQL语句
规范与基本操作
MySQL 数据库实用指南:测试数据准备、
SQL语句
规范与基本操作
sql 语句的limit的用法
sql 语句的limit的用法 SELECT * FROM table LIMIT [offset,] rows | rows OFFSET offset mysql> SELECT * FROM table LIMIT 5,10; // 检索记录行 6-15 //为了检索从某一个偏移量到记录集的结束所有的记录行,可以指定第二个参数为 -1: mysql> SELECT
笔试题
sql语句
求出第二高的分数
表非常简单 现在求出第二高的分数 思路一:分页 SELECT score FROM tb_score ORDER BY score DESC LIMIT 1,1 此时查询结果是90。如果题目要求去掉重复第一名,则 SELECT DISTINCT score FROM tb_score ORDER BY score DESC LIMIT 1,1 此时查询结果是88,distinct关键字修饰的字...
MS-SQL Server
34,576
社区成员
254,587
社区内容
发帖
与我相关
我的任务
MS-SQL Server
MS-SQL Server相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章