当前位置: 首页 > news >正文

龙华做棋牌网站建设多少钱建设工程报建网站查询

龙华做棋牌网站建设多少钱,建设工程报建网站查询,网站升级每天自动更新,wordpress侧边栏工具数据库基础知识sql和mysql的区别#xff1a;数据库查询大全#xff08;select#xff09;1、select 字段名 from 表#xff1b;2、In查询#xff1a;用于过滤你所需要查询的内容3、范围查询#xff1a;between4、模糊查询#xff1a;like5、查询空值/非空#xff1a;is… 数据库基础知识sql和mysql的区别数据库查询大全select1、select 字段名 from 表2、In查询用于过滤你所需要查询的内容3、范围查询between4、模糊查询like5、查询空值/非空is null/not null6、去除重复结果distinct7、多条件查询 and、or8、分组查询查询的每个分组中首次出现的一条记录9、对查询结果排序order by默认升序10、对查询结果数量进行限制limitSelect聚合函数1总数count2最大值max3最小值min4求和sum5平均值AVG6比较运算符7模糊查询like8范围查询9空判断10优先级11group by(分组)12Order by排序13from(表)连接查询14查询去重distinct15所有、任一allanyMySQL常见命令1创建学生表 Student 2插入数据3查询名字为张三的学生表数据4修改编号2的学生名字为李四5 删除名字为张三的学生6查询语文老师的名字用inner join联查两个表7统计语文成绩大于70的学生信息8统计各科分数大于80的人2、mysql默认端口为3、mysql索引sql和mysql的区别 1、sql是一种数据库语言而mysql是DBMS数据库管理系统 2、SQL用于访问更新和操作数据库中的数据而mysql允许保持数据库中存在的数据 3、sql的语言是固定的而mysql可以获得频繁的更新。 数据库查询大全select 1、select 字段名 from 表 2、In查询用于过滤你所需要查询的内容 select 字段名 from 表名 where 字段名 in具体内容 3、范围查询between select 字段名 from 表名 where 字段名 between 数值1 and 数值2Eg查询当字段Salary范围在3000~5000时字段Name和Salary的内容。select Name,Salary from t_emp where Salary between 3000 and 50004、模糊查询like select 字段名 from 表名 where 字段名 like 模糊条件模糊条件中”%”与”_”区别“%a”无论字符a前面有多少字符 ”_a”字符a前面只有一个字符。Eg查询所有Name以字母C为第二个字符员工的Name和Salary的内容。select Name,Salary from t_emp where Name like _C%5、查询空值/非空is null/not null select 字段名 from 表名 where 字段名 is null6、去除重复结果distinct Eg返回数据表中字段Name不重复的内容。select distinct Name from t_emp7、多条件查询 and、or Select 字段名 from 表名 where 表达式1 and/or 表达式2–查询10号部门工资大于1000的员工信息 select * from emp where deptno10 and sal1000; –查询10号部门或者工资小于2000的员工信息 select * from emp where deptno10 or sal2000; in后面跟一个集合或者子查询oracle中表示一个简单的集合 元素元素… 元素 例如 1,2,3,4,5 (‘a’,‘b’,‘c’,‘d’) –查询emp表中工资是8001600或者3000的员工信息 select * from emp where sal in(800,1600,3000); 8、分组查询查询的每个分组中首次出现的一条记录 select 字段名 from 表名 group by 待分组的字段名9、对查询结果排序order by默认升序 Select 字段名 from 表名 where 条件 order by 待排序字段名 asc/descasc升序默认值可省略 desc降序Eg查询class_id为1的所有信息以score降序的方式显示结果。select * from tb_score where class_id 1 order by score desc10、对查询结果数量进行限制limit Select 字段名 from 表名 limit 偏移值 记录个数Eg按成绩降序后查询班级中第2名到第5名的学生信息。select * from tb_score group by score desc limit 1,4注偏移值默认为0可不写1代表从第一个数开始取4代表共记录4个结果Select聚合函数 1总数count count(*)表示计算总行数括号中写星与列名结果相同例1.查询登录系统学总数 select count(*) from StudentBindPaperTypeEntity –查询员工表中的员工人数 select count(empno) from emp; select count(*) from emp; 2最大值max max(列)求此列的最大值例2.求下表的最大编号 select max(StudentID) from StudentBindPaperTypeEntity –查询10号部门的最高工资 select max(sal) from emp where deptno10; 3最小值min min(列)求此列的最小值例3.求下表编号最小编号 select min(StudentID) from StudentBindPaperTypeEntity –查询最低工资 select min(sal) from emp; 4求和sum sum(列)求此列之和注:sum运算符与数字类型连用例4.查询当前在线的学生(IsUse0表示未在线1表示在线) select SUM(IsUse) from StudentBindPaperTypeEntity –查询工资总和 select sum(sal) from emp; 5平均值AVG avg(列) 表示求此列的平均值注avg运算符与数字类型连用例5查询学生编号的平均数 select avg(StudentID) from StudentBindPaperTypeEntity –查询员工的平均工资 select avg(sal) from emp; 6比较运算符 例1.查询学号18832650890的学生 select * from StudentBindPaperTypeEntity where StudentID18832650890 例2.查询学号!18832650890的学生(同效) select * from StudentBindPaperTypeEntity where StudentID!18832650890 7模糊查询like %表示任意多个字符例1.查询1月8号考试的学生 select * from StudentBindPaperTypeEntity where TimeTamp like ‘2020-01-08%’ 例2.查询不是1月8号考试的学生 select * from StudentBindPaperTypeEntity where TimeTamp not like ‘2020-01-08%’ 8范围查询 in关键字为非连续查询例1.查询两个不相邻的学号的学生 select * from StudentBindPaperTypeEntity where StudentID in(‘19100142001’,‘19100142006’) Between…and…为连续查询(注sql软件情况不一样可能不包含and后的值) 例2.查询两个学号之间的学生 select * from StudentBindPaperTypeEntity where StudentID Between 19100142001 and 19100142006 9空判断 is null判断为空例1.查询没有试卷的学生 select * from StudentBindPaperTypeEntity where PaperType is null is not null 判断非空 例2.查询有试卷的学生 select * from StudentBindPaperTypeEntity where PaperType is not null 10优先级 优先级由高到低的顺序为 小括号not比较运算符逻辑运算符 and比or先运算如果同时出现并希望先算or需要结合()使用 11group by(分组) 作用将字段间一对多的关系向一的方向靠拢分组例1.查出参加考试有几个学院 select CollegeID from StudentBindPaperTypeEntity group by CollegeID 例2.查出各个学院参加考试的人数 select CollegeID, count(StudentID) from StudentBindPaperTypeEntity group by CollegeID –查询各个部门的部门编号和部门的平均工资 select deptno,avg(sal) from emp group by deptno; –查询各个部门的员工人数 select deptno,count(empno) from emp group by deptno; where和having的异同where条件where后面跟的条件比having后的条件先执行条件中不允许使用聚合函数。 having条件中可以使用聚合函数一般having和group by联用。 group byhavinghaving的作用跟where子句功能一样只不过having只用在group by例3.查出学院ID大于10的学院 select CollegeID from StudentBindPaperTypeEntity group by CollegeID having CollegeID10 12Order by排序 排序查询语法 select * from 表名 order by 列1 asc|desc [,列2 asc|desc,…] 如果列1的值相同则按照列2排序以此类推。 1.asc从小到大升序 2.desc从大到小降序 例1.根据学院分组ID降序(desc) select CollegeID from StudentBindPaperTypeEntity group by CollegeID order by CollegeID desc 例2.将上表升序(asc) select CollegeID from StudentBindPaperTypeEntity group by CollegeID order by CollegeID asc –查询员工信息按照部门编号升序排序如果部门编号相同时按照工资的升序排序。 select * from emp order by deptno asc,sal asc; 13from(表)连接查询 连接查询 1.内连接Inner join 2.左连接Left join 3.右连接Right join 左外连接左表的值会全部显示出来右表的值显示on条件搜索的的结果搜索不到为NULL。 select score.studentID,score.score,s.CollegeID,s.major,s.majorClass from StudentInfoEntity as s left join ScoreEntity as score on s.studentIDscore.studentID 右外连接与左外连接相反右表的值全部显示出来。 select score.studentID,score.score,s.CollegeID,s.major,s.majorClass from ScoreEntity as score right join StudentInfoEntity as s on s.studentIDscore.studentID 14查询去重distinct 表示查询得到的结果如果有重复就删掉。 select distinct sex from student; 15所有、任一allany 后面都跟一个集合或者子查询 all:表示大于集合中最大的元素 all1,2,3,4,5 等价于 5 all:表示小于集合中最小的元素 all(1,2,3,4,5) 等价于 1 any:表示大于集合中最小的元素 any(1,2,3,4,5) 等价于 1 any:表示小于集合中最大的元素 any(1,2,3,4,5) 等价于 5 –查询员工信息要求员工的工资比以下的值都低 160020003000 select * from emp where sal all(1600,2000,3000); –查询比下任意一个1600,2000,3000工资高的员工信息 select * from emp where salany(1000,2000,3000); –查询工资比所有人1600,2000,3000都高的员工信息 select * from emp where sal all(1600,2000,3000); MySQL常见命令 1创建学生表 Student Create table Student( Sid varchar(10) not null primary key, Sname varchar(10) not null, Sage int(2) not null, Ssex varchar(2), ) 2插入数据 insert into Student(Sid,Sname,Sage,Ssex) values (‘1’,‘张三’,‘20’,‘女’) 3查询名字为张三的学生表数据 select * from Student where Sname‘张三’ 4修改编号2的学生名字为李四 update Student set Sname‘李四’ where Sid‘2’ 5 删除名字为张三的学生 delete from Student where Sname‘张三’ 6查询语文老师的名字用inner join联查两个表 select teacher.Tname from teacher inner join course where teacher.Tid course.Tid and course.Tname ‘语文’ 7统计语文成绩大于70的学生信息 select a.Sname,a.Sage,a.Ssex,b.score from Student a, SC b where a.Sidb.Sid and b.Cid1 and b.score 70 8统计各科分数大于80的人 select a.Sid,a.Sname from student a, (select Sid from sc group by Sid having min(score) 80) as b where b.Sid a.Sid; 2、mysql默认端口为 3306Windows通过更改my.ini配置更改端口linux通过更改my.conf来更改端口。 3、mysql索引 mysql索引的建立大大的提高了mysql的检索速度但是对数据的updateinsertdelete的效率就有所降低。
http://www.hkea.cn/news/14333116/

相关文章:

  • html5单页网站模板上海服装贸易公司排名
  • 淘宝客网站做百度竞价网站开发交付
  • 用vs做购物网站代码网站被安全狗拦截
  • 网站开发技术网站建设时应该做的优化
  • 帮人做钓鱼网站自己怎样建立个人网站
  • 山东网站备案 论坛网站ftp地址查询
  • 网站必须做商标么企业网站开发用什么
  • 韶关市建设局网站页面设计的英文
  • 个人淘宝客网站wordpress接入微信支付
  • 专业的网站搭建多少钱天津网站建设首选 津坤科技
  • 石家庄制作网站推广咨询工程师
  • 蓝色织梦cms企业网站模板全站源码图书电子商务网站建设
  • 网站建设过程有哪几个阶段wordpress 定制首页
  • 建设企业门户网站推动政务网站建设
  • 建行网站会员有什么用h5网站快速搭建
  • 城乡建设吧部网站下载企业网站
  • 广州网站推广联盟广告设计logo标志
  • 怎么做网站滑动图片部分h5石家庄市工程建设造价管理站网站
  • 大型门户网站建设包括哪些方面故事网站模版
  • 怎么查看网站是否被百度惩罚降权或者被k手机网站用什么语言开发
  • 凡客诚品官网入口seo对各类网站的作用
  • 外贸响应式网站网络服务的重要性?
  • 网站建设相关知识博客成都线上推广平台
  • aspx 网站开发工具数据分析一般用什么软件
  • 房产发布网站建设自己网站建设多少钱
  • 网站建设实训心得 总结网络品牌维护
  • 网站建设改版升级网站制作好以后怎么管理
  • 网站建设合同模板有没有个人做的网站赚流量费
  • 合肥公司制作网站的只需要手机号的广告
  • 旅游公共信息服务网站建设及服务质量标准网站开发多钱