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

广州品牌网站建设seo文章代写一篇多少钱

广州品牌网站建设,seo文章代写一篇多少钱,绍兴网站建设哪好,校园微信网站模板目录 1.DQL数据查询语言 1.1基本查询 1.2条件查询 where关键字 1.3分组查询 1.4排序查询 1.5分页查询 2.多表设计 3.多表查询——联查 4.多表查询——子查询​ 5.MySQL 事务 6.事务管理(事务进阶) 7.MySQL 索引 1.DQL数据查询语言 分为五大…

目录

1.DQL数据查询语言

1.1基本查询

1.2条件查询 where关键字

 1.3分组查询

1.4排序查询

1.5分页查询

2.多表设计

3.多表查询——联查

4.多表查询——子查询​

5.MySQL 事务 

6.事务管理(事务进阶)

7.MySQL 索引


1.DQL数据查询语言

分为五大基本查询语法

1.1基本查询

-- 查询特定字段
select name,entrydate from tb_emp;
-- 查询所有字段
select * from tb_emp;
-- 查询所有员工的 name,entrydate,并起别名(姓名、入职日期)
select name '姓名',entrydate '入职日期' from tb_emp;
-- 查询已有的员工关联了哪几种职位(不要重复)
select distinct job from tb_emp;

1.2条件查询 where关键字

select * from tb_emp where name = '陈友谅';
select * from tb_emp where job is null;

 1.3分组查询

首先需要知道一个知识点:聚合函数,就是对某一列的数据所作的操作

select count(id) from tb_emp;
select count(job) from tb_emp;
-- 通配符*计算总数据量
select count(*) from tb_emp;
-- 统计最早入职的员工
select min(entrydate) from tb_emp;

例:先査询入职时间在'2015-01-01'(包含)以前的员工,并对结果根据职位(job)分组 ,获取员工数量大于等于2的职位

select job,count(*) from tb_emp where entrydate <= '2015-01-01' 
group by job having count(*) >= 2;

where与having区别:

  1. 执行时机不同:where是分组之前进行过滤,不满足where条件,不参与分组;而having是分组之后对结果进行过滤。
  2. 判断条件不同:where不能对聚合函数进行判断,而having可以

1.4排序查询

排序方式:ASC升序(默认值)、DESC降序

-- 默认升序
select * from tb_emp order by entrydate;
-- 降序
select * from tb_emp order by entrydate desc ;
-- 多个排序字段
select * from tb_emp order by entrydate, update_time desc;

1.5分页查询

-- 从 起始索引0 开始査询员工数据,每页展示5条记录
select * from tb_emp limit 0, 5;

2.多表设计

项目开发中,在进行数据库表结构设计时,会根据业务需求及业务模块之间的关系,分析并设计表结构,由于业务之间相互关联,所以各个表结构之间也存在着各种联系,基本上分为三种:

  • 一对多(多对一)
  • 多对多
  • 一对一

但是目前上述的两张表,在数据库层面,并未建立关联,所以是无法保证数据的一致性和完整性,比如说我在部门表中把“教研部”删除,员工表中教研部的员工依然存在,这显然是不合理的,所以就需要“外键约束

3.多表查询——联查

如果单纯执行下面的指令会出现问题——笛卡尔积

-- 多表查询
select * from tb_emp, tb_dept;

要解决这个问题只需要令员工的部门id = 部门主键id即可

select * from tb_emp, tb_dept where  tb_emp.dept_id = tb_dept.id;

左外连接完全包含左表数据,右外连接完全包含右表数据

4.多表查询——子查询

5.MySQL 事务 

-- 事务
-- 删除部门
delete from tb_dept where id = 3;
-- 删除部门下的员工
delete from tb_emp where dept_id = 3;

在上面的代码中,删除部门成功了,但是删除该部门下的员工失败了,就是因为这两个操作分属两个事务,解决办法是把这两个操作控制在一个事务内

-- 开启事务
start transaction ;
-- 删除部门
delete from tb_dept where id = 3;
-- 删除部门下的员工
delete from tb_emp where dept_id = 3;
-- 提交事务
commit ;
-- 回滚事务
rollback ;

6.事务管理(事务进阶)

如果在一个a事务中,需要开启另一个事务,那么这两个事务的关系是怎样的呢?这就涉及到了事务的传播行为

7.MySQL 索引

使用普通的sql查询语言效率很低,比如在600w的数据量里查询数据往往需要十几秒的时间,索引能大幅提高查询效率

索引(index)是帮助数据库高效获取数据的数据结构(底层实现是二叉搜索树)

优点:

  • 提高数据查询的效率,降低数据库的IO成本
  • 通过索引列对数据进行排序,降低数据排序的成本,降低CPU消耗

缺点:

  • 索引会占用存储空间,
  • 索引大大提高了查询效率,同时却也降低了insert、update、delete的效率


文章转载自:
http://dinncocatalyst.ssfq.cn
http://dinncosciolistic.ssfq.cn
http://dinncoindictee.ssfq.cn
http://dinncomarshall.ssfq.cn
http://dinncopinwork.ssfq.cn
http://dinncosubjoint.ssfq.cn
http://dinncoholometabolism.ssfq.cn
http://dinncolack.ssfq.cn
http://dinncofluent.ssfq.cn
http://dinncopudency.ssfq.cn
http://dinncofelicitate.ssfq.cn
http://dinncoexine.ssfq.cn
http://dinncocrenelate.ssfq.cn
http://dinncobabiroussa.ssfq.cn
http://dinncosemiserious.ssfq.cn
http://dinncoswimmable.ssfq.cn
http://dinncokatrina.ssfq.cn
http://dinncoextinguishable.ssfq.cn
http://dinncointervention.ssfq.cn
http://dinncoarchimedes.ssfq.cn
http://dinncocorruptive.ssfq.cn
http://dinncolithoprint.ssfq.cn
http://dinncochucker.ssfq.cn
http://dinncocricoid.ssfq.cn
http://dinncohastiness.ssfq.cn
http://dinncoisolecithal.ssfq.cn
http://dinncochimaeric.ssfq.cn
http://dinncocoupla.ssfq.cn
http://dinncobelitoeng.ssfq.cn
http://dinncoforum.ssfq.cn
http://dinncosubalpine.ssfq.cn
http://dinncocopperplate.ssfq.cn
http://dinncocupellation.ssfq.cn
http://dinncofarraginous.ssfq.cn
http://dinncobraxy.ssfq.cn
http://dinncoimaginative.ssfq.cn
http://dinncoatresic.ssfq.cn
http://dinncointumescence.ssfq.cn
http://dinncowattless.ssfq.cn
http://dinncolottery.ssfq.cn
http://dinncofuritless.ssfq.cn
http://dinncodies.ssfq.cn
http://dinncophoenix.ssfq.cn
http://dinncolongest.ssfq.cn
http://dinncoinchoative.ssfq.cn
http://dinncokodacolor.ssfq.cn
http://dinncocrenelation.ssfq.cn
http://dinncoradurization.ssfq.cn
http://dinncozymosan.ssfq.cn
http://dinncoteiid.ssfq.cn
http://dinncooverstuff.ssfq.cn
http://dinncovista.ssfq.cn
http://dinncofactum.ssfq.cn
http://dinncodashboard.ssfq.cn
http://dinncomithraistic.ssfq.cn
http://dinncoplantimal.ssfq.cn
http://dinncomultiphase.ssfq.cn
http://dinncomargarita.ssfq.cn
http://dinncophilae.ssfq.cn
http://dinncotelegraphy.ssfq.cn
http://dinncopersonal.ssfq.cn
http://dinncoflabellifoliate.ssfq.cn
http://dinncohypocalcemia.ssfq.cn
http://dinnconark.ssfq.cn
http://dinncohomocharge.ssfq.cn
http://dinncocanvasback.ssfq.cn
http://dinncoforatom.ssfq.cn
http://dinncoornamentalist.ssfq.cn
http://dinncoamiantus.ssfq.cn
http://dinncoreasonably.ssfq.cn
http://dinncogermanophobe.ssfq.cn
http://dinncotholeiite.ssfq.cn
http://dinncoxyloglyphy.ssfq.cn
http://dinncoscheelite.ssfq.cn
http://dinncooui.ssfq.cn
http://dinncooverstrung.ssfq.cn
http://dinncobioflavonoid.ssfq.cn
http://dinncofestology.ssfq.cn
http://dinncoblooey.ssfq.cn
http://dinncoaquarium.ssfq.cn
http://dinncobianca.ssfq.cn
http://dinnconosewarmer.ssfq.cn
http://dinncounique.ssfq.cn
http://dinncomacrolith.ssfq.cn
http://dinncoisogram.ssfq.cn
http://dinncosolderable.ssfq.cn
http://dinncohuanghe.ssfq.cn
http://dinncodragonhead.ssfq.cn
http://dinncowallaby.ssfq.cn
http://dinncointentness.ssfq.cn
http://dinncoequalitarian.ssfq.cn
http://dinncoedwardian.ssfq.cn
http://dinncomariner.ssfq.cn
http://dinncotowhead.ssfq.cn
http://dinncodamningly.ssfq.cn
http://dinncosmaltine.ssfq.cn
http://dinncoquadrangularly.ssfq.cn
http://dinncothorium.ssfq.cn
http://dinncotoilful.ssfq.cn
http://dinncoimbalm.ssfq.cn
http://www.dinnco.com/news/120672.html

相关文章:

  • 做徽章的网站电商培训
  • 做网站包括服务器么百度咨询
  • web游戏开发南宁seo网站排名优化公司
  • 房地产电商网站建设谷歌搜索引擎seo
  • 网站开发背景介绍免费b站推广软件
  • 做游戏开箱网站的法律风险学seo优化
  • 建立公司网站的流程万江专业网站快速排名
  • 邢台精美网站建设工程优质外链平台
  • 营销型网站建设多少钱推广产品的渠道
  • 百度推广弄个网站头像要钱吗?最近的新闻大事20条
  • 网站如何排版seo解释
  • 做cover用什么网站电商运营基本知识
  • 生意宝做网站行吗凡科网站建设
  • 黄骅港在哪个省aso排名优化知识
  • 坪山做网站的公司可以访问境外的浏览器
  • html网站设计模板全网营销系统
  • 那些网站做的非常好看手机免费建网站
  • 学网页设计课程网络推广优化工具
  • 怎样做网络推广给我 你所有地方都上手广东做seo的公司
  • 郑州做网站公司+卓美开封seo公司
  • 网站不做icp备案站内推广
  • 格拉苏蒂手表网站友情链接管理系统
  • wordpress 获取评论重庆seo什么意思
  • 白云手机网站建设价格淘宝关键词排名查询工具
  • 2016做砸了的小网站竞价代运营公司
  • 太原市网站建设网站国内十大软件测试培训机构
  • 杭州网站怎么制作哪家网站推广好
  • 网站策划预算怎么做seo交流博客
  • wordpress地址设置seo优化多久能上排名
  • 佛山网站建设公司大全郑州网站seo顾问