create table test_create_table_CreateAs as select * from test_create_table; 表结构的破坏 复制字段结构 复制表结构 LIKE
案例中:
索引丢失、分区丢失
实际测试
Target Server Type : MYSQL
Target Server Version : 50616
File Encoding : 65001
Date: 2019-03-20 15:08:45
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for test_create_table
-- ----------------------------
DROP TABLE IF EXISTS `test_create_table`;
CREATE TABLE `test_create_table` (
`uid` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
`pv` smallint(6) NOT NULL DEFAULT '0' COMMENT '浏览总量',
`ip` bigint(20) NOT NULL DEFAULT '0' COMMENT 'ip',
`date` date NOT NULL DEFAULT '0000-00-00' COMMENT '日期',
KEY `idx_uid` (`uid`),
KEY `date` (`date`),
KEY `uid_date` (`uid`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='访问页面统计总表';
-- ----------------------------
-- Records of test_create_table
-- ----------------------------
INSERT INTO `test_create_table` VALUES ('435345', '0', '0', '2019-02-27');
INSERT INTO `test_create_table` VALUES ('5464', '0', '0', '2019-03-14');
Target Server Type : MYSQL
Target Server Version : 50616
File Encoding : 65001
Date: 2019-03-20 15:11:24
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for test_create_table_createas
-- ----------------------------
DROP TABLE IF EXISTS `test_create_table_createas`;
CREATE TABLE `test_create_table_createas` (
`uid` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
`pv` smallint(6) NOT NULL DEFAULT '0' COMMENT '浏览总量',
`ip` bigint(20) NOT NULL DEFAULT '0' COMMENT 'ip',
`date` date NOT NULL DEFAULT '0000-00-00' COMMENT '日期'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of test_create_table_createas
-- ----------------------------
INSERT INTO `test_create_table_createas` VALUES ('435345', '0', '0', '2019-02-27');
INSERT INTO `test_create_table_createas` VALUES ('5464', '0', '0', '2019-03-14');
索引丢失
create table test_create_table_CreateLike LIKE test_create_table;
insert into test_create_table_CreateLike SELECT * FROM test_create_table;
复制结构
Target Server Type : MYSQL
Target Server Version : 50616
File Encoding : 65001
Date: 2019-03-20 15:31:48
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for test_create_table_createlike
-- ----------------------------
DROP TABLE IF EXISTS `test_create_table_createlike`;
CREATE TABLE `test_create_table_createlike` (
`uid` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
`pv` smallint(6) NOT NULL DEFAULT '0' COMMENT '浏览总量',
`ip` bigint(20) NOT NULL DEFAULT '0' COMMENT 'ip',
`date` date NOT NULL DEFAULT '0000-00-00' COMMENT '日期',
KEY `idx_uid` (`uid`),
KEY `date` (`date`),
KEY `uid_date` (`uid`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='访问页面统计总表';
-- ----------------------------
-- Records of test_create_table_createlike
-- ----------------------------
INSERT INTO `test_create_table_createlike` VALUES ('435345', '0', '0', '2019-02-27');
INSERT INTO `test_create_table_createlike` VALUES ('5464', '0', '0', '2019-03-14');
插入数据
drop table if EXISTS test_create_table_CreateLike;
create table test_create_table_CreateAs as select * from test_create_table; 表结构的破坏 复制字段结构 复制表结构 LIKE的更多相关文章
- create table b1 as select * from b建表锁表测试
A: create table a1 like a; insert into a1 as select * from a; B: create table b1 as select * from b; ...
- create table:使用SELECT语句创建表
oracle下直接(创建表) create table newtablename as select * from oldtablename sqlserver的语法是(自动创建表) : select ...
- 用复制方式创建表 Create Table tbname as select * from user.tab where ...
用复制方式创建表 Create Table tbname as select * from user.tab where ...
- create table xxx as select 与 create table xxx like
create table xxx ) | NO | PRI | NULL | auto_increment | | Name | varchar() | NO | ...
- hive基本的操作语句(实例简单易懂,create table XX as select XX)
hive建表语句DML:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Cr ...
- create table repo_folder_operate_log_bak as select * from repo_folder_operate_log;
create table repo_folder_operate_log_bak as select * from repo_folder_operate_log;
- MongoDB 实现 create table tab2 as select
1. var result = db.foo.aggregate(...);db.bar.insert(result.result); 2. var temp1 = db.mtb1.find(name ...
- Oracle中的自连接(self join)-当表中的某一个字段与这个表中另外字段的相关时,我们可能用到自连接。
http://blog.163.com/wkyuyang_001/blog/static/10802122820091751049479/ 当表中的某一个字段与这个表中另外字段的相关时,我们可能用到自 ...
- oracle数据库【表复制】insert into select from跟create table as select * from 两种表复制语句区别
create table as select * from和insert into select from两种表复制语句区别 create table targer_table as select ...
随机推荐
- 如何用javac 和java 编译运行整个Java工程
转自:http://blog.csdn.net/huagong_adu/article/details/6929817 前言:本文教你怎么用javac和Java命令,以及如何利用脚本(she ...
- 开源CFD并非万金油
今天有网友在群里讨论开发CFD软件的事情,众说纷纭,有网友提到"没有必要开发CFD软件了,直接使用开源OpenFOAM就行".但个人认为这说法还是有一些需要商榷的地方,开源软件也不 ...
- 【iCore1S 双核心板_FPGA】例程一:GPIO输出实验——点亮LED
实验现象: 三色LED循环点亮. 核心源代码: //--------------------Module_LED-----------------------------// module LED( ...
- 【iCore1S 双核心板_FPGA】例程八:触发器实验——触发器的使用
实验现象: 在本实验中,将工程中的D触发器.JK触发器实例化,对应其真值表,用signal对其进行 检验,利用SignaTap II观察分析波形. 核心代码: module D( input CLK, ...
- React Native常用组件之ScrollView
1. 两个要点 1.1 ScrollView必须有一个确定的高度才能正常工作 它实际上所做的就是将一系列不确定高度的子组件装进一个确定高度的容器(通过滚动操作) 通常有两种做法: 第一种: 直接给该S ...
- 【转】WPF自定义控件与样式(6)-ScrollViewer与ListBox自定义样式
一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等. 本文主要内容: ScrollViewer的样式拆解及基本样式定义: ListBox集合 ...
- 第三百九十九节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署CentOS6.5安装mysql5.6
第三百九十九节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署CentOS6.5安装mysql5.6 1.检测系统是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步 ...
- DWZ使用中遇到的坑
DWZ官方文档中关于文件上传表单的提交: 因为Ajax不支持enctype="multipart/form-data" 所以用隐藏iframe来处理无刷新表单提交. <for ...
- [Laravel] 08 - Auth & Data Migration
登录注册框架 一.加载Auth模块 Step 1, 安装Auth模块 生成相关 laravel 框架内部的代码模块: $ php artisan make:auth 自动添加了路由代码 在larave ...
- 使用 ssh -R 穿透局域网访问内部服务器主机,反向代理 无人值守化
一.搭建SSH方向代理 准备: 局域网主机(虚拟主机): 192.168.6.233 CentOS 6.7 阿里云服务器:120.25.68.60 CentOS 6.7 1. 阿里云服务器12 ...