#创建数据库
CREATE DATABASE GXDATA DEFAULT CHARACTER SET gb2312;
#创建部门信息表
CREATE TABLE depinfo (
Dep_no CHAR(2) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL,
Dep_name VARCHAR(50) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL,
Dep_Address VARCHAR(50) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL,
Dep_Tel VARCHAR(50) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL
)ENGINE=MyISAM DEFAULT CHARSET=gb2312;
临时表(数据库关闭后自动删除临时表)
CREATE TEMPORARY TABLE table_name(......定义列......)
克隆表
CREATE TEMPORARY TABLE new_table LIKE original_table
根据查询结果建表
CREATE TEMPORARY TABLE table_name SELECT ... ...
查询,改变表存储引擎
SELECT ENGIN FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='database_name' AND TABLE_NAME ='tabne_name'
SHOW TABLE STATUS LIKE 'table_name' G
SHOW CREATE TABLE table_name G
改变存储引擎
ALTER TABLE table_name ENGINE=InnoDB
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。