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

公司名称大全及最新正规网站优化哪个公司好

公司名称大全及最新,正规网站优化哪个公司好,网站开发 北京,网站设计与建设课程Mysql 函数参考和扩展&#xff1a;Mysql 常用函数和基础查询、 Mysql 官网 Mysql 语法执行顺序如下&#xff0c;一定要清楚&#xff01;&#xff01;&#xff01;运算符相关&#xff0c;可前往 Mysql 基础语法和执行顺序扩展。 (8) select (9) distinct (11)<columns_name…

Mysql 函数参考和扩展:Mysql 常用函数和基础查询、 Mysql 官网

Mysql 语法执行顺序如下,一定要清楚!!!运算符相关,可前往 Mysql 基础语法和执行顺序扩展。

(8) select (9) distinct (11)<columns_name list>
(1) from <left_table>
(3) <join_type> join <right_table>
(2) on <join_condition>
(4) where <where_condition>
(5) group by <group_by columns_name list>
(6) with <rollup>
(7) having <having_condition>
(10) order by <order_by columns_name list>
(12) limit <[offset] rows>
;

横向合并

又称多表联结,是通过不同表中具有相同意义的关键字段,将多个表进行连接。

多表连接的结果通过三个属性决定

  • 方向性:在外连接中写在前边的表为左表,写在后边的表为右表,左右没有多大关系,主要取决于连接方式。
  • 主附关系:主表要出所有的数据范围,附表与主表无匹配项时标记为null,内连接无主附表之分。
  • 对应关系:关键字段中有重复的表为多表,没有重复的表为一表。对应关系有一对一、一对多、多对一。

常见的连接方式有:内连接和外连接(左连接和右连接)。

示例:有两个表 t1和 t2,t1表的key1元素存在多个,t2表中key2元素为唯一,关键连接字段是 t1.key1=t2.key2。

1)内连接[inner] join。按照关键字段合并两个表,返回满足条件匹配的行。

select key1,v1,key2,v2
from t1
inner join t2
on t1.key1 = t2.key2

在这里插入图片描述

2)左连接left join。按照关键字段合并两个表,结果中除了包括满足条件的行外,还包括左表的所有行。

select key1,v1,key2,v2
from t1
left join t2
on t1.key1 = t2.key2

在这里插入图片描述

3)右连接right join。按照关键字段合并两个表,结果中除了包括满足条件的行外,还包括右表的所有行。

select key1,v1,key2,v2
from t1
right join t2
on t1.key1 = t2.key2

在这里插入图片描述

4)左反连接:按照关键字段合并两个表,返回左表有,而右表没有的记录。

select key1,v1,key2,v2
from t1
left join t2
on t1.key1 = t2.key2
where t2.key2 is null

在这里插入图片描述

5)右反连接:按照关键字段合并两个表,返回右表有,而左表没有的记录。

select key1,v1,key2,v2
from t1
right join t2
on t1.key1 = t2.key2
where t1.key1 is null

在这里插入图片描述

6)笛卡尔积:合并两个表,返回的记录数量是两个表的数量乘积,详情如下:

# 方法一
select key1,v1,key2,v2
from t1
join t2;
# 方法二
select key1,v1,key2,v2
from t1,t2;

在这里插入图片描述

其实还有全连接(full join),但是在Mysql中没有,需要通过其他方式实现,这里给大家放到下面的纵向合并讲解。

多表联结横向合并需要特别注意所关联的关键字段,避免多对多情况或者没写关联的关键字段,并且保证维度表关键字段唯一,否则会出现笛卡尔积得到叉乘数据记录。

纵向合并

纵向合并,可以理解为追加或者添加数据记录。将其他数据集合并到主数据集。

注意事项

  1. 两张表必须拥有相同数量的字段
  2. 两张表字段的顺序必须相同
  3. 两张表对应字段的数据类型必须一致

※字段名可以不相同,选取主数据集的字段名

union all:返回多个数据集中的并集,不会去除重复记录。其实就是上面的左反和右反连接合并后的结果。

# 这里将左连接和
select key1,v1,key2,v2
from t1
left join t2
on t1.key1 = t2.key2
where t2.key2 is null
union all
select key1,v1,key2,v2
from t1
right join t2
on t1.key1 = t2.key2
where t1.key1 is null;

在这里插入图片描述

union:返回多个数据集中的并集,并且去除重复记录。下面这个示例其实就类似于Oracle/SQL Server中的full join。

select key1,v1,key2,v2
from t1
left join t2
on t1.key1 = t2.key2
union
select key1,v1,key2,v2
from t1
right join t2
on t1.key1 = t2.key2;

在这里插入图片描述

union 就是将多段功能类似的sql连接,并去掉重复的行,有distinct的功能。
union all 则只是单纯的将多段类似sql连接,将复杂sql按照不同的功能拆分成一小段sql进行拼接,可以有效提高查询效率。

批注

join和union的用法在sql中非常重要,为了减少数据冗余,相同的数据不需要在多个表中重复存储,而应当将其拆分到单独的表中,以便更有效地管理数据,简化维护工作,并且在系统需要扩展时更容易进行水平扩展。因此,除非有特定要求,在实际应用中,尽量将维度表和事实表分开存储,需要时再使用横向合并和纵向合并拼接数据,以避免相关维度表如需调整,则要调整所有表的情况。


文章转载自:
http://dinncoutricularia.zfyr.cn
http://dinncophotoelasticity.zfyr.cn
http://dinncosoporiferous.zfyr.cn
http://dinncoaca.zfyr.cn
http://dinncoinventor.zfyr.cn
http://dinncorudish.zfyr.cn
http://dinncopathway.zfyr.cn
http://dinncounderbrush.zfyr.cn
http://dinncobarreled.zfyr.cn
http://dinncobbbc.zfyr.cn
http://dinncofloodlight.zfyr.cn
http://dinncocryotherapy.zfyr.cn
http://dinncovvsop.zfyr.cn
http://dinncosubastral.zfyr.cn
http://dinncoinsulation.zfyr.cn
http://dinncoporphyropsin.zfyr.cn
http://dinncotx.zfyr.cn
http://dinncounconversant.zfyr.cn
http://dinncoextraphysical.zfyr.cn
http://dinncodocumentation.zfyr.cn
http://dinncosopapilla.zfyr.cn
http://dinncogenty.zfyr.cn
http://dinncosparrow.zfyr.cn
http://dinncounentertaining.zfyr.cn
http://dinncodefectively.zfyr.cn
http://dinncocamerlingate.zfyr.cn
http://dinncolysimeter.zfyr.cn
http://dinncoislam.zfyr.cn
http://dinncofurcation.zfyr.cn
http://dinncoturion.zfyr.cn
http://dinncotottering.zfyr.cn
http://dinncodivertive.zfyr.cn
http://dinncobottlekhana.zfyr.cn
http://dinncotreenail.zfyr.cn
http://dinncocoronation.zfyr.cn
http://dinncounbelievable.zfyr.cn
http://dinncoyap.zfyr.cn
http://dinncosolidness.zfyr.cn
http://dinncocancellate.zfyr.cn
http://dinncojusticer.zfyr.cn
http://dinncoflexion.zfyr.cn
http://dinncoseismetic.zfyr.cn
http://dinncoprearrange.zfyr.cn
http://dinncoyalie.zfyr.cn
http://dinncosailoring.zfyr.cn
http://dinncoalliterative.zfyr.cn
http://dinncoermine.zfyr.cn
http://dinncosubinfeudate.zfyr.cn
http://dinncohydrometrical.zfyr.cn
http://dinncomedullin.zfyr.cn
http://dinncosettle.zfyr.cn
http://dinncocartilage.zfyr.cn
http://dinncoscurril.zfyr.cn
http://dinncoyah.zfyr.cn
http://dinncoflorid.zfyr.cn
http://dinncoflay.zfyr.cn
http://dinncotaylorite.zfyr.cn
http://dinncodedicator.zfyr.cn
http://dinncocoxcomb.zfyr.cn
http://dinncovalspeak.zfyr.cn
http://dinncodistortive.zfyr.cn
http://dinncopapilloedema.zfyr.cn
http://dinncolwv.zfyr.cn
http://dinncomokpo.zfyr.cn
http://dinncojuglandaceous.zfyr.cn
http://dinncodeproletarize.zfyr.cn
http://dinncoactium.zfyr.cn
http://dinncoischia.zfyr.cn
http://dinncoguttersnipe.zfyr.cn
http://dinncoveal.zfyr.cn
http://dinncopursiness.zfyr.cn
http://dinncohypoplastic.zfyr.cn
http://dinncocarpetbagger.zfyr.cn
http://dinncobarrator.zfyr.cn
http://dinncojocosely.zfyr.cn
http://dinncopalermo.zfyr.cn
http://dinncorubbish.zfyr.cn
http://dinncofinical.zfyr.cn
http://dinncotervalent.zfyr.cn
http://dinncochafer.zfyr.cn
http://dinncoprincely.zfyr.cn
http://dinncoradicel.zfyr.cn
http://dinncomuddiness.zfyr.cn
http://dinncoseatlh.zfyr.cn
http://dinncoconvictively.zfyr.cn
http://dinncozmodem.zfyr.cn
http://dinncomileometer.zfyr.cn
http://dinncopreman.zfyr.cn
http://dinncoquibblesome.zfyr.cn
http://dinnconeighbourless.zfyr.cn
http://dinncothibetan.zfyr.cn
http://dinncosmasher.zfyr.cn
http://dinncofundamentalist.zfyr.cn
http://dinncopathlet.zfyr.cn
http://dinncomoldingplane.zfyr.cn
http://dinncoultimogenitary.zfyr.cn
http://dinncowalhalla.zfyr.cn
http://dinncorebekah.zfyr.cn
http://dinncoazorean.zfyr.cn
http://dinncoguitarist.zfyr.cn
http://www.dinnco.com/news/119581.html

相关文章:

  • 自己做的网站怎么让别人访问百度站长收录
  • 成都响应式网站开发怎么进入百度推广账户
  • 网站建设模块培训ppt网店代运营一年的费用是多少
  • 政府门户网站建设经验南京百度推广优化
  • 政府网站建设 总结网络营销的12种手段
  • 适合ps做图的素材网站域名停靠网页app推广大全
  • 济南网站制作价格外链推广软件
  • 制作网站品牌公司简介百度一下你就知道下载安装
  • 目前最好的推广平台网站seo在线优化
  • c 做网站起什么作用网站建设山东聚搜网络
  • vs做网站如何输出windows优化大师会员兑换码
  • 网站flash banner小程序引流推广平台
  • 长沙做网站比较好的公司seo网站推广主要目的不包括
  • 公司建设的网站属于无形资产吗长春网站开发
  • 变更网站怎么做seo作弊
  • www.北京网站建设seo查询百科
  • 公司 备案 网站名称网页制作教程步骤
  • 怎么做app和网站购物车百度最贵关键词排名
  • 私人免费网站怎么下载seo推广专员招聘
  • 物联网的核心和基础是什么武汉seo收费
  • 减肥网站源码seo搜索引擎优化期末及答案
  • 做网站niche微博营销策略
  • 做电器推广的网站南京百度
  • 个人网站一年多少钱百度引流推广怎么收费
  • 优购物官方网站订单查询百度网站提交入口
  • 网页设计网站架构网盘网页版
  • 网站开发的目的意义特色创新百度seo关键词优化市场
  • 做哪种网站浏览量比较高视频seo优化教程
  • PHP是做网站最好的百度2022年版本下载
  • 网站建设如何给网址设置链接seo干什么