案例中:

索引丢失、分区丢失

实际测试

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的更多相关文章

  1. 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; ...

  2. create table:使用SELECT语句创建表

    oracle下直接(创建表) create table newtablename as select * from oldtablename sqlserver的语法是(自动创建表) : select ...

  3. 用复制方式创建表 Create Table tbname as select * from user.tab where ...

    用复制方式创建表 Create Table tbname as select * from user.tab where ...

  4. create table xxx as select 与 create table xxx like

    create table xxx )       | NO   | PRI | NULL    | auto_increment | | Name       | varchar() | NO   | ...

  5. hive基本的操作语句(实例简单易懂,create table XX as select XX)

    hive建表语句DML:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Cr ...

  6. 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;

  7. MongoDB 实现 create table tab2 as select

    1. var result = db.foo.aggregate(...);db.bar.insert(result.result); 2. var temp1 = db.mtb1.find(name ...

  8. Oracle中的自连接(self join)-当表中的某一个字段与这个表中另外字段的相关时,我们可能用到自连接。

    http://blog.163.com/wkyuyang_001/blog/static/10802122820091751049479/ 当表中的某一个字段与这个表中另外字段的相关时,我们可能用到自 ...

  9. 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 ...

随机推荐

  1. Spark2.3 HA集群的分布式安装

    一.下载Spark安装包 1.从官网下载 http://spark.apache.org/downloads.html 2.从微软的镜像站下载 http://mirrors.hust.edu.cn/a ...

  2. 第三部分:Android 应用程序接口指南---第五节:计算---第一章 RenderScript

    第1章 RenderScript RenderScript提供一个独立于平台并在本地运行的计算引擎,用它来加速你需要大量计算能力的应用.RenderScript是一个运行与Android上计算密集型的 ...

  3. phpcmsv9 管理加密解密

    例子:  密码:123123  encrypt:Jiu5He 第一步:  md5("123456")="4297f44b13955235245b2497399d7a93& ...

  4. java中的数据加密2 对称加密

    对称加密 也叫私钥加密.   采用单钥密码系统的加密方法,同一个密钥可以同时用作信息的加密和解密,这种加密方法称为对称加密,也称为单密钥加密. 需要对加密和解密使用相同密钥的加密算法.由于其速度快,对 ...

  5. React Native 进的第一个坑

    Bundling index.ios.js [development, non-minified, hmr disabled] 0.0% (0/1), failed. error: bundling ...

  6. hdoj:2045

    #include <iostream> using namespace std; ]; int main() { int n; a[] = ; a[] = ; a[] = ; ; i &l ...

  7. Java知多少(20)变量的作用域

    在Java中,变量的作用域分为四个级别:类级.对象实例级.方法级.块级. 类级变量又称全局级变量或静态变量,需要使用static关键字修饰,你可以与 C/C++ 中的 static 变量对比学习.类级 ...

  8. A Tour of ParallelExtensionsExtras

    Throughout the development of Parallel Extensions for the .NET Framework 4, we've come across a myri ...

  9. 第三百九十七节,Django+Xadmin打造上线标准的在线教育平台—其他插件使用说,主题本地化设置

    第三百九十七节,Django+Xadmin打造上线标准的在线教育平台—其他插件使用说,主题本地化设置 主题设置是在xadmin\plugins\themes.py这个文件 默认xadmin是通过下面这 ...

  10. snopy 数据库简介

    snoRNA ,small nucleolar RNA, 核仁小分子RNA, 是一类在细胞核内的small non-coding RNA, 长度在60-300nt, 其主要功能是调控其他小RNA分子( ...