作者:小虾米 发表时间:2017-05-10 23:40:39 类别:MySql
CREATE TABLE table_name(
id int(11) NOT NULL AUTO_INCREMENT COMMENT "",
......
)ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE table_name ADD field_name varchar(255) NOT NULL DEFAULT '' COMMENT "";
//查看简单数据结构
DESC table_name;
//查看具体列的信息
SELECT column_name,column_comment
FROM information_schema.columns
WHERE table_schema ='db' and table_name = 'tablename';
//即表创建语句
SHOW CREATE TABLE table_name;
//复制表
CREATE TABLE table1 like table;
//复制数据
INSERT INTO table1 SELECT * FROM table;
//基本语句
INSERT INTO table_name
//查询数据直接插入
INSERT INTO table_name (`user_id`,`domain`,`group`)
SELECT id,'www.baidu.com' as domain,`group` FROM table2_name WHERE '';