MySQLの一般的なSQL文の例
表アクション:
テーブルの作成:
1、CREATE TABLE table1 AS SELECT * FROM test
2、
挿入:
クエリー後挿入:insert into table 3(id,num,cd,type)select*from test limit 200100;
更新:UPDATE test SET cd='SH'WHERE cd='bj';
テーブルの作成:
1、CREATE TABLE table1 AS SELECT * FROM test
2、
CREATE TABLE `test_table` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT ' id',
`product_id` int(11) NOT NULL DEFAULT '0' COMMENT ' id',
`no` varchar(20) NOT NULL DEFAULT '' COMMENT 'num',
`content` mediumtext NOT NULL COMMENT ' ',
`add_time` datetime NOT NULL DEFAULT 'CURRENT_STAMP' COMMENT ' ( )',
`notice_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT ' ',
`times` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' ',
`is_delete`` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' ',
PRIMARY KEY (`id`),
UNIQUE KEY `no` (`no`),
KEY `product_id` (`product_id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=' ';
削除テーブル:delete from table 4挿入:
クエリー後挿入:insert into table 3(id,num,cd,type)select*from test limit 200100;
更新:UPDATE test SET cd='SH'WHERE cd='bj';