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

单位网站建设内容整合营销是什么

单位网站建设内容,整合营销是什么,桂阳局网站建设方案,做网站标题目录 一、说明二、示例2.1 simple:简单表,不使用union或者子查询2.2 primary:主查询,外层的查询2.3 subquery:select、where之后包含了子查询,在select语句中出现的子查询语句,结果不依赖于外部…

目录

        • 一、说明
        • 二、示例
            • 2.1 simple:简单表,不使用union或者子查询
            • 2.2 primary:主查询,外层的查询
            • 2.3 subquery:select、where之后包含了子查询,在select语句中出现的子查询语句,结果不依赖于外部查询(不在from语句中)
            • 2.4 dependent subquery:指在select语句中出现的查询语句,结果依赖于外部查询
            • 2.5 derived:派生表
            • 2.6 union
            • 2.7 union all
            • 2.8 dependent union
        • 三、sql脚本

一、说明

  • 1.表示select的类型,查询语句执行的查询操作的类型
  • 2.常见的取值有:simple、primary、union、subquery、dependent subquery
  • 3.simple:简单表,不使用union或者子查询
  • 4.primary:主查询,外层的查询
  • 5.union:union中的第二个或者后面的查询语句
  • 6.subquery:select、where之后包含了子查询,在select语句中出现的子查询语句,结果不依赖于外部查询(不在from语句中)
  • 7.dependent subquery:指在select语句中出现的查询语句,结果依赖于外部查询
  • 8.derived:派生表,在from子句的查询语句,表示从外部数据源中推导出来,不是从select语句中的其他列中选择出来的
  • 9.union:分union与union all两种,若第二个select出现在union之后,则被标记为union;如果union被from子句的子查询包含,则第一个select会被标记为derived;union会针对相同的结果集进行去重,union all不会进行去重处理
  • 10.dependent union:当union作为子查询时,第一个union为dependent subquery,第二个union为dependent union

二、示例

2.1 simple:简单表,不使用union或者子查询
1.单表的select_type,不使用union和子查询
explain select * from users;

在这里插入图片描述

2.表连接查询的select_type,不使用union和子查询
explain select * from users inner join orders where users.id = orders.user_id;

在这里插入图片描述

2.2 primary:主查询,外层的查询
explain select id from users union select id from orders;

在这里插入图片描述

2.3 subquery:select、where之后包含了子查询,在select语句中出现的子查询语句,结果不依赖于外部查询(不在from语句中)
explain select orders.*,(select product_name from products where id = 10001) from orders;

在这里插入图片描述

2.4 dependent subquery:指在select语句中出现的查询语句,结果依赖于外部查询
explain select orders.*,(select product_name from products where id = orders.product_id) from orders;

在这里插入图片描述

2.5 derived:派生表
-- 关闭对衍生表合并优化
set session optimizer_switch='derived_merge=off';
-- 查看optimizer_switch参数
show variables like '%optimizer_switch%';
-- 
explain select * from (select user_id from orders where id = 10001) as temp;
-- 还原表合并优化
set session optimizer_switch='derived_merge=on';

在这里插入图片描述

2.6 union

1.union result:union关键字会将数据结果进行去重,会使用一个临时表,临时表的记录会被标记为union result

explain select * from (select id from products where product_price = 8000 union select id from orders where user_id = 20001 union select id from users where user_name = '张三' ) as temp;

在这里插入图片描述

2.7 union all
explain select * from (select id from products where product_price = 8000 union all select id from orders where user_id = 20001 union all select id from users where user_name = '张三' ) as temp;

在这里插入图片描述

2.8 dependent union
explain select * from orders where id in (select id from products where product_price = 8000 union all select id from orders where user_id = 20001
union all select id from users where user_name = '张三');

在这里插入图片描述

三、sql脚本

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;-- ----------------------------
-- Table structure for orders
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders`  (`id` int(0) NOT NULL COMMENT '主键id',`price` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '订单总额',`user_id` int(0) DEFAULT NULL COMMENT '用户id',`product_id` int(0) DEFAULT NULL COMMENT '产品id',`number` int(0) DEFAULT NULL COMMENT '产品数量',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;-- ----------------------------
-- Records of orders
-- ----------------------------
INSERT INTO `orders` VALUES (10001, '80000', 20001, 10001, 10);-- ----------------------------
-- Table structure for products
-- ----------------------------
DROP TABLE IF EXISTS `products`;
CREATE TABLE `products`  (`id` int(0) NOT NULL COMMENT '主键id',`product_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '商品名称',`product_price` decimal(10, 2) DEFAULT NULL COMMENT '商品价格',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;-- ----------------------------
-- Records of products
-- ----------------------------
INSERT INTO `products` VALUES (10001, '苹果手机', 8000.00);-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users`  (`id` int(0) NOT NULL COMMENT '主键id',`user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名称',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES (20001, '张三');SET FOREIGN_KEY_CHECKS = 1;
http://www.hrbkazy.com/news/13627.html

相关文章:

  • 做包皮医院网站郑州粒米seo外包
  • 做淘宝客网站域名是别人的昆明优化网站公司
  • 杭州桐庐网站建设seo专员是什么职位
  • 网站设计价格360建站和凡科哪个好
  • 做网站被网警找win10优化大师免费版
  • 怎样建立手机网站高权重外链
  • 网站建设素材使用应该注意什么什么是网店推广
  • 网站可以做推广吗全自动推广引流软件免费
  • 内网网站搭建教程引擎优化seo
  • 济宁网站建设百度搜索引擎关键词优化
  • 有什么平台可以免费发布推广信息关键词快速排名seo怎么优化
  • 建e室内设计网app黑帽seo技术论坛
  • 网站建设风格定位庆云网站seo
  • 网站转让 备案吗百度推广客户端教程
  • 坪山模板网站建设公司关键词优化的最佳方法
  • java做网站后端域名服务器ip查询网站
  • 杭州 城西 做网站有什么推广的平台
  • wordpress设定网站站内关键词优化
  • 求网站制作湖南网络推广服务
  • wordpress主题 v7独立站seo搜索优化
  • 网站建设专业的公司百度问一问付费咨询
  • 网站项目流程表谷歌seo排名技巧
  • 网站备案是备案域名还是空间深圳市社会组织总会
  • 绍兴柯桥哪里有做网站的佛山网络排名优化
  • ftp 修改网站做引流的公司是正规的吗
  • 大型企业网络建设河南seo快速排名
  • 房地产公司网站建设与推广方案怎样加入网络营销公司
  • 淘宝毕业设计网站代做seo零基础教学视频
  • 做网站的一个黑点符号营销最好的方法
  • dede 网站被复制石家庄网络推广平台