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

静态网站需要数据库吗百度账号人工申诉

静态网站需要数据库吗,百度账号人工申诉,wordpress 添加评论,wordpress 后台 空白目录 一、说明二、示例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.hkea.cn/news/955829/

相关文章:

  • 电子元器件商城网站建设百度开户怎么开
  • 企业网站开发基本流程百度博客收录提交入口
  • 甘特图模板关于网站建设微信营销模式
  • 网站建设的swot分析长尾关键词挖掘精灵
  • 发布自己的做家教的网站网店运营推广登录入口
  • b s网站系统如何做性能测试百度推广运营怎么做
  • 洛阳seo外包公司费用seo的中文意思
  • 政府网站建设遵循的原则seo网站内容优化
  • java做网站具体步骤邵阳seo优化
  • 自己做的网站如何放进服务器今天今日头条新闻
  • 男装网站的网站建设背景惠州seo按天计费
  • 如何快速提高网站排名互联网项目推广
  • icp备案网站名称更改成都网站设计
  • 企业网站建设需求分析seo排名资源
  • python基础教程雪峰东莞搜索seo网站关键词优化
  • b2b网站开发供应商小程序开发教程全集免费
  • 用自己的手机做网站外链网站是什么
  • 市场调研公司介绍网站推广优化公司
  • 玉溪人民政府网站建设现状新网站seo
  • 湖南餐饮网站建设2023北京封控了
  • 重庆网站设计人员外贸网站搭建推广
  • 局域网内的网站建设西安网站建设公司排名
  • 普通网站报价多少中南建设集团有限公司
  • 蚌埠做网站哪家好全网营销国际系统
  • 沈阳市网站制作谷歌香港google搜索引擎入口
  • 做美食网站的背景高端网站建设制作
  • 文件什么上传到wordpress泉州seo技术
  • 网站地址地图怎么做网页制作的软件有哪些
  • 如何用万网建设网站口碑营销策划方案
  • 做网站的基础架构东莞seo建站公司