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

泰州网站整站优化比较出名做耐克的网站

泰州网站整站优化,比较出名做耐克的网站,自学电商还是去培训机构,中国制造网app官方下载文章目录 一. 结果排序二. 筛选分页结果三. Update四. Delete五. 截断表六. 插入查询结果结束语 操作如下表 //创建表结构 mysql create table exam_result(- id int unsigned primary key auto_increment,- name varchar(20) not null comment 同学姓名,- chi… 文章目录 一. 结果排序二. 筛选分页结果三. Update四. Delete五. 截断表六. 插入查询结果结束语 操作如下表 //创建表结构 mysql create table exam_result(- id int unsigned primary key auto_increment,- name varchar(20) not null comment 同学姓名,- chinese float default 0.0 comment 语文成绩,- math float default 0.0 comment 数学成绩,- english float default 0.0 comment 英语成绩- );//插入测试数据 INSERT INTO exam_result (name, chinese, math, english) VALUES (唐三藏, 67, 98, 56), (孙悟空, 87, 78, 77), (猪悟能, 88, 98, 90), (曹孟德, 82, 84, 67), (刘玄德, 55, 85, 45), (孙权, 70, 73, 78), (宋公明, 75, 65, 30);一. 结果排序 语法 ASC 升序从小到大 DESX 降序从大到小 排序默认为ASC 升序 select ... from table_name order by 属性 [ASC 或者 DESC] 注意没有order by 子句的查询返回的顺序是未定义的。 NULL值比任何值都小 查询同学及数学成绩按数学成绩升序显示 mysql select name,math from exam_result order by math; ----------------- | name | math | ----------------- | 宋公明 | 65 | | 孙权 | 73 | | 孙悟空 | 78 | | 曹孟德 | 84 | | 刘玄德 | 85 | | 唐三藏 | 98 | | 猪悟能 | 98 | -----------------查询同学各门成绩依次按 数学降序英语升序语文升序的方式显示 多字段排序排序优先级随书写顺序 mysql select name,math,english,chinese from exam_result order by math desc,english asc,math asc; ----------------------------------- | name | math | english | chinese | ----------------------------------- | 唐三藏 | 98 | 56 | 67 | | 猪悟能 | 98 | 90 | 88 | | 刘玄德 | 85 | 45 | 55 | | 曹孟德 | 84 | 67 | 82 | | 孙悟空 | 78 | 77 | 87 | | 孙权 | 73 | 78 | 70 | | 宋公明 | 65 | 30 | 75 | -----------------------------------查询同学及总分由高到低 order by 子句可以使用别名 mysql select name,chinesemathenglish as total from exam_result order by total desc; ------------------ | name | total | ------------------ | 猪悟能 | 276 | | 孙悟空 | 242 | | 曹孟德 | 233 | | 唐三藏 | 221 | | 孙权 | 221 | | 刘玄德 | 185 | | 宋公明 | 170 | ------------------查询姓孙的同学或者姓曹的同学的数学成绩结果按数学成绩由高到低显示 mysql select name,math from exam_result where name like 孙% or name like 曹% order by math desc; ----------------- | name | math | ----------------- | 曹孟德 | 84 | | 孙悟空 | 78 | | 孙权 | 73 | -----------------二. 筛选分页结果 行的起始下标是0 从0开始筛选n条结果默认从0开始 select ... from table_name ... limit n 从s开始筛选n条结果 select ... from table_name ... limit s,n 从s开始筛选n条结果建议使用 select ... from table_name ... limit n offset s 注意对未知表进行查询时最好加一条limit 1避免因为表中数据过大查询全表数据导致数据库卡死 按id进行分页每页3条记录分别显示第1,23页 //第一页 mysql select id,name,math,english,chinese from exam_result order by id limit 3 offset 0; --------------------------------------- | id | name | math | english | chinese | --------------------------------------- | 1 | 唐三藏 | 98 | 56 | 67 | | 2 | 孙悟空 | 78 | 77 | 87 | | 3 | 猪悟能 | 98 | 90 | 88 | --------------------------------------- //第二页 mysql select id,name,math,english,chinese from exam_result order by id limit 3 offset 3; --------------------------------------- | id | name | math | english | chinese | --------------------------------------- | 4 | 曹孟德 | 84 | 67 | 82 | | 5 | 刘玄德 | 85 | 45 | 55 | | 6 | 孙权 | 73 | 78 | 70 | --------------------------------------- //第三页 mysql select id,name,math,english,chinese from exam_result order by id limit 3 offset 6; --------------------------------------- | id | name | math | english | chinese | --------------------------------------- | 7 | 宋公明 | 65 | 30 | 75 | ---------------------------------------三. Update update table_name set 属性数据 [where...] [order by ...] [limit ...] []内的容可以省略 将孙悟空同学的数学成绩变更为80分 mysql update exam_result set math80 where name孙悟空;将曹孟德同学的数学成绩变更为60分语文成绩变更为70分 mysql update exam_result set math60,chinese70 where name曹孟德;将总成绩倒数前三的3位同学的数学成绩加上30分 MySQL不支持math30但可以使用mathmath30 mysql update exam_result set mathmath30 order by englishmathchinese limit 3;将所有同学的语文成绩更新为原来的2倍 没有where子句的update会更新全表数据 update exam_result set chinesechinese*2;四. Delete delete from table_name [where...] [order by...] [limit ...] 删除孙悟空同学的信息 delete from exam_result where name孙悟空;删除整表数据 注意慎用 delete from table_name; 需要注意的是delete删除数据不会改变auto_increment自增长的记录 五. 截断表 truncate [table] table_name; 注意此操作慎用 只能对整表操作不能像delete那样针对部分数据使用实际上truncate不对数据操作所以比delete更快但是truncate在删除数据的时候并不经过真正的事物所以无法回滚会重置auto_increment 六. 插入查询结果 insert into table_name 属性列 select ... 将select查询的结果插入表中 实验删除表中的重复数据重复数据只能有一份 mysql create table duplicate_table(- id int,- name varchar(20)- ); mysql insert into duplicate_table values- (100,aaa),- (100,aaa),- (200,bbb),- (200,bbb),- (200,bbb),- (300,ccc);思路建立一个具有相同表结构的表然后将dupliate_table的数据无重复的查找出来然后插入新表中再将新表重命名为duplicate_table //建立新表 mysql create table no_duplicate_table like duplicate_table; //将查询的无重复的数据插入新表 mysql insert into no_duplicate_table select distinct * from duplicate_table; //删除旧表 mysql drop table duplicate_table; //重命名新表 mysql rename table no_duplicate_table to duplicate_table;结束语 感谢你的阅读 如果觉得本篇文章对你有所帮助的话不妨点个赞支持一下博主拜托啦这对我真的很重要。
http://www.zqtcl.cn/news/326487/

相关文章:

  • 网站建设+太原1核1g可以做几个网站
  • 电商设计网站有哪些内容西安百度推广外包
  • 深圳网站建设价格多少做废旧金属的网站
  • wordpress 文档超级优化空间
  • 湖北seo网站推广官方网站怎么制作
  • 随州网站seo诊断wordpress 只显示一个主题
  • 建站登录可信网站认证 费用
  • 互站网站源码用jsp做网站一般会用到什么
  • 个人免费设计网站fomo3d 网站怎么做
  • 菏泽做网站公司公关公司经营范围
  • 钓鱼网站营销型网站建设实战
  • 可以下载电影的网站怎么做做网站公司西安
  • 自己做签名网站网店美工培训教程
  • 宁波产品网站设计模板php 网站 教程
  • 制作一个网站的费用是多少免费网站空间怎么
  • 如何建立自己的微网站网站建设教程怎么建
  • seo网站项目讲解沈阳网红
  • 苏州大型网站建设公司网站外链优化
  • 阿里云购买域名后怎么建网站沂南网站设计
  • 网站建设基础考试php网站开发入门
  • 广州五屏网站建设seo诊断报告示例
  • 周浦高端网站建设公司信阳做网站的公司
  • 博客网站怎么建设湛江新闻头条最新消息
  • 外贸网站建设 评价有没有教做网站实例视频
  • 县 住房和城乡建设局网站wordpress接入支付宝
  • 网站建设初期推广方式天津网站建设案例
  • 销项税和进项导入是在国税网站做吗凡科网站模块
  • 苏州建网站皆去苏州聚尚网络常州企业建站系统
  • 网站建设明细wordpress 主题稳定
  • 网站设计论文前言怎么写肇庆网站开发哪家专业