zdly.net
当前位置:首页 >> 面试题目(sql) >>

面试题目(sql)

我使用的是MySQL 如下语句: 建表语句: create table Lessoninfo( no int, week int, isonduty char); 插入数据:略 insert into Lessoninfo values(...............) SQL查询语句: select no as '教师号', sum(week=1) as '星期一',sum(week=...

1. select * from student where score>80 and s_id in (select sid from student_class where c_id=(select c_id from class where c_name='一班')) 2. select c.c_name,女生人数=sum(s.s_id),平均分=avg(s.score) from classes c inner join s...

简单回答:防止——利用即有的应用、功能,将(恶意)SQL命令发送到到后台数据库引擎。 ----------详述,及关键要点,有耐心可以看一看-------- -------(下面的论述,要看懂需要有基本的SQL数据库编程和操作知识,本人实际经验,仅供参考)------...

select a.user_job as "职业",b.man_num as "男性人数",c.woman_num as "女性人数",count(id) as "总人数" from user a left join (select user_job,count(id) as man_num from user where user_sex=1 group by user_job) b on a.user_job=b.use...

--查询工资最高的三位人员信息 SELECT TOP 3 * FROM emp ORDER BY salary DESC --查询工资由低到高排序好的第3到第5条记录 SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY salary DESC) AS RowNumber,* FROM emp) AS C WHERE C.RowNumber>=3...

比如学生表,有学号,姓名,年龄,性别这四个字段 select a.学号,a.姓名,a.年龄,a.性别,sum(c.成绩) as 总成绩from 学生表 a,成绩表 b,选课表 c where a.学号=b.学号and b.课程号=c.课程号group by a.学号,a.姓名,a.年龄,a.性别order by a.姓名 ...

可以这样说 使用索引,把所建的索引所用列名,用在where语句中,并尽量在条件的最右边 在Sql语句中,把条件最小的写在最右边,如果id=?写在最右边 在sql尽量少写子查询,用join语句代替,少写in,like,or

不能执行,这个是错的,

1). select g_applydate from g_cardapply a,g_cardapplydetail b where a.g_applyno=b.g_applyno and b.g_idcard='440401430103082' 2). select g_idcard,count(g_idcard) as records from g_cardapplydetail group by g_idcard having count(g...

update g_cardapplydetail set g_state='07' where g_idcard = '440401430103082' update g_cardapply set g_state = '07' where g_applyno in (select g_applyno from g_cardapplydetail where g_idcard = '440401430103082')

网站首页 | 网站地图
All rights reserved Powered by www.zdly.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com