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

网站产品页如何做优化陕西省城乡建设学校网站

网站产品页如何做优化,陕西省城乡建设学校网站,做网站 用 显示器,做网站什么价位1.基本查询 //查询所有内容 select * from 表名;//查询指定字段 select 字段1#xff0c;字段2#xff0c;字段3.....from 表名;//查询时给字段起别名 select 字段1 as 别名1 , 字段2 as 别名2 ... from 表名#xff1b;//去重查询 select distinct 字段列表 from 表名; …1.基本查询 //查询所有内容 select * from 表名;//查询指定字段 select 字段1字段2字段3.....from 表名;//查询时给字段起别名 select 字段1 as 别名1 , 字段2 as 别名2 ... from 表名//去重查询 select distinct 字段列表 from 表名; 2.条件查询 //语法 select 字段列表 from 1 表名 where 条件列表 ;//算数运算 mysql select 5, 53, 5-3, 5*3, 5/3, 5.2/3, 5%3, 3%5, 50%30 from dual; ------------------------------------------------------ | 5 | 53 | 5-3 | 5*3 | 5/3 | 5.2/3 | 5%3 | 3%5 | 50%30 | ------------------------------------------------------ | 5 | 8 | 2 | 15 | 1.6667 | 1.73333 | 2 | 3 | 20 | ------------------------------------------------------ //dual表是一个虚拟表用于测试或者在没有真实表的情况下执行一些查询操作可以省略from dual//省略from dual表字句查看日期时间 mysql select now(); --------------------- | now() | --------------------- | 2023-08-03 14:24:59 | --------------------- 1 row in set (0.00 sec)//字符串123会转为数值123 mysql select 12380; ---------- | 12380 | ---------- | 203 | ---------- 1 row in set (0.00 sec)//非数值字符串进行数值运算会转为0 mysql select china80; ------------ | china80 | ------------ | 80 | ------------ 1 row in set, 1 warning (0.00 sec)//注意这里是字符串null mysql select NULL100; ------------ | NULL100 | ------------ | 100 | ------------ 1 row in set, 1 warning (0.00 sec)//这才是NULL mysql select NULL100; ---------- | NULL100 | ---------- | NULL | ---------- 1 row in set (0.00 sec)# 查询总分大于200的学生信息 mysql select distinct name 姓名 , chinesemathenglish 总分 from student3 where (chinesemathenglish)200;# 查询男生的信息 mysql select * from student3 where gender男;# 查询英语成绩在80到90之间的学生信息 mysql select * from student3 where english80 and english90 ; mysql select * from student3 where english between 80 and 90 ;# 查询英语成绩不在80到90之间的学生信息 mysql select * from student3 where not(english80 and english90) ;# 查询数学分数为8590的学生信息 mysql select * from student3 where math85 or math90 ; mysql select * from student3 where math in (85,90) ;# 查询数学分数不为8590的学生信息 mysql select * from student3 where !(math85 or math90) ;# 查询所有姓李的学生语文成绩 mysql select name ,gender, chinese from student3 where name like 李% ;# 查询姓名为两个字的信息 mysql select * from student3 where name like __ ; # 两个_# 插入新数据 mysql insert into student3(id,name,gender) values (9,周星星,男);# 查询语文没有考试的学生信息 mysql select * from student3 where chinese is NULL; mysql select * from student3 where chinese NULL;# 安全等于作用 # 可作为普通运算符的 # 或等价于is NULL # 正则表达式作为条件 //匹配以数字 9 开头的字符串。 mysql select * from student3 where math regexp ^9; # 关键字regexp 3.聚合函数 count(*)所有行进行统计包括NULL行 count(1)所有行进行统计包括NULL行 count(某字段)对某字段中非Null进行统计 4.分组查询 //语法 select 字段,聚合函数 from 表名 [ where 条件 ] group by 字段 [ having 分组后过滤条件 ];# 按照班级分组 mysql select class_id as 班级编号, round(avg(score),2) as 平均成绩 from transcript group by class_id; # 查询平均分在90分及以上的班级 mysql select class_id as 班级, avg(score) as 平均分 from transcript group by class_id having avg(score)90;# 查询每个班级的成绩平均分不统计成绩在85分以下的学生且过滤掉平均分在90分以下的班级以便比较不 同班级的成绩 mysql select class_id as 班级, avg(score) as 平均分 from transcript where score85 group by class_id having avg(score)90;where与having区别 # 执行时机不同where是分组之前进行过滤不满足where条件不参与分组而having是分组之后对结果进 行过滤。 # 判断条件不同where不能对聚合函数进行判断而having可以。 5.排序查询 order by 字段1 asc/desc, 字段2 asc/desc.....mysql select * from student3 order by math ; mysql select * from student3 order by math desc;# 中文排序由于使用字符编码不同会出现问题如按性别升序则女在前男在后了 mysql select * from student3 order by gender asc; mysql show variables like character_set%; # 查看当前使用的编码# 使用CONVERT函数按照指定编码排序 mysql select * from student3 order by convert(gender using gbk) asc; mysql select * from student3 order by convert(name using gbk) asc;# 分组排序先按性别排序组内部按语文成绩降序排列 mysql select * from student3 order by convert(gender using gbk) asc,chinese desc; 6.分页查询 mysql select * from student3;mysql select * from student3 limit 2,3; # 查看第2条开始的记录显示3条包含第2条mysql select * from student3 limit 3; # 查看3条记录mysql select * from student3 limit 3 offset 2; # 查看第2条开始的3条记录同limit 2,3
http://www.dnsts.com.cn/news/75597.html

相关文章:

  • 上海徐汇网站建设公司开发公司融资专干笔试
  • 可以写代码的网站产品代理平台
  • 龙岗网站建设哪家好网页图片设置
  • 专注网站建设与优化辽宁平台网站建设平台
  • 毕业设计做系统网站好成都百度推广开户公司
  • 如何建立竞价网站网站开发 产品经理
  • 网站开发背景图模板wordpress admin_init
  • 西安阎良区建设局网站国家住房与城乡建设部网站首页
  • 德阳网站开发熊掌号网站建设报价方案doc
  • 厦门地税网站建设平台类网站有哪些
  • 给小学生做家教的网站广州公司注册官网
  • 上传下载文件网站开发的php源码详情页模板哪个网站好
  • 学生制作网站建设 维护最新提升关键词排名软件
  • 网站建设报价单表格模板网站建设基本流程规范
  • 石家庄建设网站公司网站的主页按钮怎么做
  • 网站更换模板123上网
  • wordpress 全站ssl青岛建设官方网站
  • 网站建设协议 模板义乌小程序开发
  • 天津建设网站的公司哪家好安徽省住房和城乡建设厅网站首页
  • 中国万网icp网站备案专题悟空crm免费开源版
  • 网站推广的目标标志设计网站推荐
  • 移动端网站交互效果最好的做pc网站
  • 具有品牌的常州做网站锦州网页制作
  • 青岛网站建设方案维护网络推广的策略方法
  • 老年门户网站建设的意义二手车网站系统
  • 海尔网站推广策划方案四川建设厅网站复查中
  • 网站标题分隔符泉州专业网站建设哪家好
  • 网站模块设计怎么做wap微信网站模板
  • 建设网站需求如何查询网站快照
  • iis网站连接数重庆简易注销在什么网站做