sql所有姓张年龄加一,sql查询姓张的学生有多少人

http://www.itjxue.com  2023-01-15 16:04  来源:未知  点击次数: 

SQL数据库问题

create table TableX(Code varchar(10), Name varchar(50), Age varchar(10));

d

select * from TableX where Name like '张%' order by Age asc;

select * from ?TableX, TableY where xCode=yCode and Class='计算机' and score60;

select TableX.Name,TableY.Class,TableY.Score from TableX,TableY where xCode=yCode;

insert into TableX (xCode,Name,Age) values(‘97005’,‘赵六’,‘20’);

update TableX set Age=21 where xCode='97004';

delete from TableX where xCode not in(select xCode from TableY);

access sql查找语言

1.select Sname ,datepart(year,getdate())-sage from student

2.select * from student where deptno='01'

3.select Sname ,sage from student where sname like '张%'

4.select t1.sname,t1.sage,t2.dname from student t1,college t2 where t1.deptno=t2.deptno

5.select sno,sname from student where deptno in (select deptno from student where sname='刘晨')

6.select * from student where deptno in ('01','02')

7.update student

set deptno ='02'

where sno='20060001'

8.update student

set sage='20'

where sname='张雨'

9.update student

set age=age-1

where ssex='女'

10.delete from student where sno='20060004'

11.select * from student order by deptno

12.select deptno,count(*) as 人数 from student group by deptno

13.select Sname ,sage from student where sage=(select min(sage) from student)

用SQL语句完成下列操作要求

1.insert into stuinfo(stuid,stname,sex,nation,class,address) values(2015121226,张三,男,白族,15计算机网络,云南大理);

2.delete course where cname='foxpro应用基础';

3.select stname as 姓名,round(to_number(to_char(sysdate,'yyyy')-to_char(birthdate,'yyyy'))) as 年龄,class as 班级 from stuinfo where round(to_number(to_char(sysdate,'yyyy')-to_char(birthdate,'yyyy')))=20;

4.select st.stuid as 学号,st.stname as 姓名 from stuinfo st inner join course c on c.cid=st.stuid inner join score sc on sc.cid=c.cid where sc.score in (select max(score) from score);

5.select st.stuid as 学号,st.stname as 姓名,c.cname as 课程名称,sc.score as 成绩 from stuinfo st inner join course c on c.cid=st.stuid inner join score sc on sc.cid=c.cid;

6.select st.stname as 姓名 from stuinfo where address in (select address from stuinfo where stname='张三');

7.select stname as 姓名,to_char(sysdate,'yyyy')-to_char(substr(zjh,7,4)) as 年龄 from stuinfo

8.create or replace procedure stmax

as

fs nvarchar2(200);

mz nvarchar2(200);

begin

select c.cname into mz,sc.score into fs from course c inner join score sc on sc.cid=c.cid group by c.cname;

DBMS_OUTPUT.put_line(mz||':'||fs);

end;

9.触发器略过

10.略

11.update course set cname='数据库原理与应用' where cname='数据库原理';

12.select * from stuinfo where stname like '张%';

13.select * from stuinfo where nation !='汉族';

14.select c.cname,AVG(sc.score) from course c inner join score sc on sc.cid=c.cid group by c.cname;

累死,望采纳

请帮忙写出下列SQL语句的步骤: 1.查询成绩表的所有成绩 2.查询学生的学号,姓名和年龄 (接着在下面)

你表的字段和表的关系都没给....

只能认为表里面有所有的字段了...

1 select * from 成绩表

2 select 学号,姓名,年龄 from 学生信息表

3 select 学号,姓名,课程名,成绩 from 选课表

4 select * from 学生信息表 where 姓名 like '张%'

5 select top 4 * from 学生信息表 where 学号 like '9952%'

6 select count(*) as 男生人数 from 学生信息表 where 性别='男'

7 select * form 学生信息表 where 性别='女' and 党员='是'

8 select 学号 from 成绩表 where 成绩80 and 成绩90

9 select 学号,姓名 from 成绩表 where 成绩60

PS:这题,如果姓名不在成绩表中的话应该是:

select 学号,姓名 from 成绩表,学生信息表 where 成绩表.学号=学生信息表.学号 and 成绩表.成绩60

10 select 学号,姓名,性别 from 学生信息表 order by 学号 desc

这里我把"学生表"写成"学生信息表",是为了看着更清楚

如果要改的话,自己看着改

使用SQL语句完成下列查询:急急急~~~~~~~~~~~~~~~··

select * from 学生表

select 学号,姓名,年龄 from 学生表

select 学号,姓名,课程名称,成绩 where 选课学生 = 选课学生(不知道你的表,不是很清楚)

select * from 学生表 t where t.name like '张'

我靠 不想写了..诶 想写这么多吧

下列是一个学生选课数据库的关系模型,请按要求写出T-SQL语句。

(1)

create table 学生(

学号 int primary key,

姓名 varchar(4),

性别 char(2),

年龄 int,

系号 int foreign key

)

(2)

select * from 学生 where 姓名 like '张%';

(3)

select 学号,姓名 from 学生 where 学号 in(

select 学号 from 选课 where 课程号 = (

select 课程号 from 课程 where 课程名 = ‘SQL Server’

)

);

(4)

select 课程名 from 课程 where 课程号 not in (

select 课程号 from 选课

);

(5)

select 学号,姓名,性别,年龄+1 as 年龄,系号 from 学生;

(6)

select * from 学生 where 学号 in (

select 学号 from 选课 where 成绩 = 0

);

(责任编辑:IT教学网)

更多

推荐通讯数据软件文章