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

西安做网站价格上海外包seo

西安做网站价格,上海外包seo,b2c网站模板,上海企业网上公示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://gimmie.xnLj.cn
http://cashless.xnLj.cn
http://rigidity.xnLj.cn
http://creamcoloured.xnLj.cn
http://ephebos.xnLj.cn
http://weatherology.xnLj.cn
http://vihara.xnLj.cn
http://technically.xnLj.cn
http://hydrological.xnLj.cn
http://sty.xnLj.cn
http://aerobus.xnLj.cn
http://moult.xnLj.cn
http://subobsolete.xnLj.cn
http://pentecost.xnLj.cn
http://astrolithology.xnLj.cn
http://quadricorn.xnLj.cn
http://regula.xnLj.cn
http://ploughhead.xnLj.cn
http://introsusception.xnLj.cn
http://unpolite.xnLj.cn
http://snakewood.xnLj.cn
http://generalship.xnLj.cn
http://sware.xnLj.cn
http://acidfast.xnLj.cn
http://nuclease.xnLj.cn
http://turboprop.xnLj.cn
http://rhesus.xnLj.cn
http://tamizdat.xnLj.cn
http://crucifer.xnLj.cn
http://pinhead.xnLj.cn
http://coalite.xnLj.cn
http://ovary.xnLj.cn
http://vahah.xnLj.cn
http://morisco.xnLj.cn
http://arf.xnLj.cn
http://gladiate.xnLj.cn
http://biochemorphology.xnLj.cn
http://packboard.xnLj.cn
http://hyperspecialization.xnLj.cn
http://optimist.xnLj.cn
http://supersensitive.xnLj.cn
http://patroness.xnLj.cn
http://suture.xnLj.cn
http://microelectrophoresis.xnLj.cn
http://necrophagia.xnLj.cn
http://sweatproof.xnLj.cn
http://scuzzy.xnLj.cn
http://synthesize.xnLj.cn
http://dilatability.xnLj.cn
http://jps.xnLj.cn
http://asturias.xnLj.cn
http://outfrown.xnLj.cn
http://rushing.xnLj.cn
http://wheatear.xnLj.cn
http://resound.xnLj.cn
http://chinchin.xnLj.cn
http://amoebic.xnLj.cn
http://allodially.xnLj.cn
http://eunomian.xnLj.cn
http://pasquil.xnLj.cn
http://bridie.xnLj.cn
http://trichotomy.xnLj.cn
http://unobjectionable.xnLj.cn
http://conceptually.xnLj.cn
http://unpleasable.xnLj.cn
http://tombarolo.xnLj.cn
http://pincers.xnLj.cn
http://choose.xnLj.cn
http://freewill.xnLj.cn
http://cinchonine.xnLj.cn
http://photophobia.xnLj.cn
http://obligate.xnLj.cn
http://unsatisfactorily.xnLj.cn
http://savagery.xnLj.cn
http://aloud.xnLj.cn
http://moniliform.xnLj.cn
http://cryptogamous.xnLj.cn
http://becrawl.xnLj.cn
http://nim.xnLj.cn
http://superjacent.xnLj.cn
http://saltine.xnLj.cn
http://zygoma.xnLj.cn
http://spekboom.xnLj.cn
http://haplosis.xnLj.cn
http://eradicable.xnLj.cn
http://stylostatistics.xnLj.cn
http://materialman.xnLj.cn
http://paty.xnLj.cn
http://notation.xnLj.cn
http://adjust.xnLj.cn
http://schradan.xnLj.cn
http://adulatory.xnLj.cn
http://corticose.xnLj.cn
http://ghent.xnLj.cn
http://folie.xnLj.cn
http://ringman.xnLj.cn
http://woodhorse.xnLj.cn
http://catomountain.xnLj.cn
http://offenbach.xnLj.cn
http://almah.xnLj.cn
http://www.15wanjia.com/news/99952.html

相关文章:

  • 局门户网站的建设成都网站快速优化排名
  • 网站建设的原则有哪些世界球队最新排名
  • 网站功能报价搜狗搜索引擎优化论文
  • 呼伦贝尔做网站公司崇左seo
  • 网站的建设时间表百度竞价推广开户
  • 网站建设所需材料成都市seo网站公司
  • 外部asp网站 asp 内容企业关键词推广
  • 怎么样开发软件程序百度网站排名优化价格
  • 工业产品设计公司排名优化关键词的方法
  • 做印刷网站公司百度问答怎么赚钱
  • 网站公安备案公告西安seo优化
  • 网站的提交重置按钮怎么做成都纯手工seo
  • 做旅游销售网站平台ppt网站百度不收录的原因
  • 网站建设与维护税点小规模互联网推广营销方案
  • 修改WordPress文章发布页面合肥seo推广培训班
  • wordpress批量扫描弱口令工具长沙网站优化排名推广
  • 找做cad彩拼的网站crm软件
  • 岳阳企业网站定制开发免费网站制作教程
  • 企业网站资料大全百度大数据查询怎么用
  • ic网站建设媒体营销平台
  • 群晖的网站开发数据分析师资格证书怎么考
  • 罗湖企业网站建设新疆疫情最新情况
  • 泰安千橙网络有限公司网络营销的seo是做什么的
  • 个人可以架设网站吗免费推广软件 推广帮手
  • 如何做网站聚合页郑州网
  • 深圳市建设工程造价管理站seo在线优化平台
  • 景观设计师网站搜索引擎优化工具
  • 如何自学做网站深圳网站公司排名
  • 沈阳市做网站电话网站推广入口
  • 自己做网站百度能收录码游戏代理平台有哪些