当前位置:首页 » 编程语言 » 自测题SQL单表查询
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

自测题SQL单表查询

发布时间: 2022-10-19 23:21:43

① 单表比较复杂的查询 高分求sql

select * from 表 a,(
select count(1),name from (select distinct name,date from 表where 两者之间的时间) b group by name having count(1)=(日期差值))
where a.name=b.name
搞定

不太懂你的说明,我QQ就是我名字,QQ上说吧

② sql语言,有一个成绩单表,已知学生姓名,如何查询名次

1、创建测试表,

create table test_score(name varchar2(20), score number);

③ SQL问题建表和查询的题目

create table student(stuid char(10)primary key,stuname varchar(10),major varchar(50))
go
create table book(bid char(10)primary key,title char(50),author char(20))
go
create table borrow(borrowid char(10)primary key,stuid char(10)foreign key references
student(stuid),bid char(10)foreign key references book(bid),t_time datetime,b_time datetime)
go

select c.stuid,a.stuname,c.bid,b.title,c.t_time
from student a,book b,borrow c
where a.stuid=c.stuid and b.bid=c.bid and a.major='计算机'
and c.t_time between '2007-12-15' and '2008-01-08'

select * from student where stuid in(select stuid from borrow)

select x.stuname,y..title,z.t_time,z.b_time from student x,book y,borrow z
where x.stuid=z.stuid and y.bid=z.bid and y.author='张三'

select a.stuname,COUNT(*)as 未还数量 from student a,borrow b
where a.stuid=b.stuid and b.b_time<>null
group by a.stuname

④ SQL查询题,求解

SELECT MAX(时间) FROM 表
GROUP BY 客户
ORDER BY 客户 时间 DESC

⑤ 请用SQL查询完成下列各题目:

至少要给出表名和字段名称吧,凑合着看吧:
1. select 姓名,年龄 from 表名 where 家庭住址 like '%北京市%';
2. select 姓名 from 表名 where 性别="女" and 出生年份<>'1980';
3. select 姓名,家庭住址 from 表名where 性别='男' and 姓名 like '%国%';
4. select sum(成绩),avg(成绩) from 表名 where 课程='1';
5. select count(学号) from 表名 where 课程='2';
6. select a.* from 表1 a,表2 b where b.课程='computer English' and 成绩>80 and a.学号=b.学号; (表1为课程成绩表,表2为学生信息表)
7. select * from 表名 where 家庭住址=(select 家庭住址 from 表名 where 姓名='王华');
再往下没法写了,没有表结构编不下去了...

⑥ sql数据查询中单表查询指什么

就是说只查询一个表,没有和其它表进行联合查询的。

⑦ SQL 单表查询

你这个sql 语句不是读取列,而是输出字符串"学号" 你试试select [学号] from xs
另外建议以后设计表的时候,不要用中文来命名表的列名