[SQL数据库是什么]你说的大概是这样的: 类似于EX数据库的是:Access数据库。 那么Access数据库跟sql数据库有什么不一样呢! 详解: 相同点: 1.都是采用关系来设计数据层。 2.都可以对数据进行操作。...+阅读
------------------------------------------------------ create table students(st_id varchar(20),st_name varchar(50),sex varchar(10)) insert into students(st_id,st_name,sex) select 'st001','张杰', '男' union all select 'st002', '公孙燕飞' ,'男' union all select 'st003', '王楠', '女' union all select 'st004', '王伟', '男' union all select 'st005','李燕纹', '女' union all select 'st006', '孙武' ,'男' select * from students create table teachers(t_id varchar(20),t_name varchar(50),t_lesson varchar(50)) insert into teachers select 't001', '张老师' ,'数学' union all select 't002', '李老师', '英语' delete from results create table results(r_id varchar(20),r_fenshu int,r_stid varchar(50),r_tid varchar(50)) insert into results select 'r001','90', 'st001', 't002' union all select 'r002', '68', 'st005', 't001' union all select 'r003', '92', 'st003' ,'t001' union all select 'r004', '82', 'st006', 't002' union all select 'r005', '70', 'st002', 't002' union all select 'r006', '86', 'st002', 't001' union all select 'r007', '57', 'st003', 't002' union all select 'r008', '76', 'st006', 't001' union all select 'r009', '55', 'st001', 't001' union all select 'r010', '77', 'st004', 't002' union all select 'r011', '58', 'st005', 't002' ---------------------------------------------------------- 1. select st_id from students where st_name = '王伟' 2.select st_id,st_name from students where st_name like '__燕%' 3 select st_name,len(st_name) as 名字长度 from students where sex ='男' 4 select min(r_fenshu) as 最低分数 from teachers t inner join results r on t.t_id =r.r_tid where t_lesson ='数学' --这个是不考虑成绩中有null值的 5 select s.st_id as 学生编号,r_fenshu as分数,r_tid as 课目号 from students s inner join results r on s.st_id =r.r_stid where s.sex='女' --如果还要课目的名称的话请用下面的 select s.st_id as 学生编号,r.r_fenshu as 分数,r.r_tid as 课目号,t.t_lesson as 课目名称 from students s inner join results r on s.st_id =r.r_stid inner join teachers t on r.r_tid = t.t_id where s.sex='女' 6 select avg(r.r_fenshu) from results r inner join teachers t on r.r_tid = t.t_id where t.t_lesson='英语' 7.select * from students s inner join results r on s.st_id =r.r_stid inner join teachers t on r.r_tid = t.t_id where s.st_id in (select top 2 st_id from students order by st_id desc) order by s.st_id desc 8 select sum(r.r_fenshu) as 总分 from results r inner join students s on r.r_stid =s.st_id where s.st_name = '王楠' 9.select distinct s.st_id,s.st_name from students s inner join results r on s.st_id = r.r_stid where st_id not in (select r_stid from results where r_fenshu<60) and st_id not in (select r_stid from results where r_fenshu >=90) 10 update results set r_fenshu = r_fenshu + 10 --如果分数不可能大于100请用这句 set r_fenshu = case when r_fenshu + 10 <=100 then r_fenshu + 10 else 100 end where r_stid in (select st_id from students where) 1 进阶题 select t.t_name,count(*) from students s,teachers t,results r where r.r_tid = t.t_id and s.st_id =r.r_stid and r.r_fenshu >= 60 and t.t_id in (select t_id from teachers where t_lesson='数学' ) --and t_lesson='数学' group by t.t_name 2 select top 1 sum(r_fenshu) as 总分,t.t_lesson,t_id,t_name from results r,teachers t where r.r_tid = t.t_id group by t.t_lesson,t_id,t_name order by 总分 desc 3. delete from results where r_stid in (select r_stid from results group by r_stid having count(r_tid) = 1) 1 选做题 select d.name from sysobjects d where d.xtype='U' 2.select top 5 * from students order by newid()
以下为关联文档:
SQL导入数据库ASP与SQL数据库连接 关键词: ASP与SQL数据库连接 <% language=VBs cript%> <% dim conn set conn=server.createobject("ADODB.connection") con.open "PROVIDER=SQLOLEDB;DATA...
如何把sql script文件导入到在sql server数据库导入SQL脚本很简单啊,那就会自动新建一个库和表,而且默认是保存到你SQL安装目录里的DATA目录 如果脚本里并没有创建数据库,那么你在执行时,旁边有一个下拉的数据库列表,你这时选...
什么是SQL数据库SQL是Structured Quevy Language(结构化查询语言)的缩写。SQL是专为数据库而建立的操作命令集,是一种功能齐全的数据库语言。在使用它时,只需要发出“做什么”的命令,“怎么做”...
sql数据库连接你看看吧,全了 。数据库的连接方法:2. ASP与SQL数据库连接:1.Access数据库的DSN-less连接方法: set adocon=Server.Createobject("adodb.connection") adoconn.Open"Driver={Micros...
连接不到数据库 SQL我也有过这们的问题,共有三种不同情况: 1.XP系统安装的版本没有打开SQL服务,无法连接,只能重装系统,并且要找可以用的,现在有许多GHOST版本的XP在安装时优化了一部分系统服务,所有S...
sql怎样连接数据库这例子中的: ip:server=127.0.0.1 (127.0.0.1就是IP了) 数据库帐号:uid= wapbbs-wy (wapbbs-wy就是帐号) 数据库: database=wapbbs-wy (wapbbs-wy数据库) pwd=adghsajkdfhsdiuh...
如何优化sql数据库在数据库应用系统中编写可执行的SQL语句可以有多种方式实现,但哪一条是最佳方案却难以确定。为了解决这一问题,有必要对SQL实施优化。简单地说,SQL语句的优化就是将性能低下的S...
sql数据库怎样安装如果安装SQL Server 2000 的话要选择个人版 如果安装SQL Server 2005 的话要选择开发版 只有出现挂起的现像才需要修改注册表 SQL Server安装文件挂起错误解决办法 具体情况...
SQL SERVER2005数据库考试题急create table T1 ( c1 VARCHAR2(6) not null, c2 VARCHAR2(6) not null, c3 VARCHAR2(6) not null, c4 VARCHAR2(6) not null, c5 VARCHAR2(6) not null) add constraint T1...