MySql将一个表的数据复制到另外一张表(表结构相同)
同一个库中进行复制
INSERT INTO book_copy SELECT * FROM book (全部复制);
INSERT INTO book_copy SELECT DISTINCT * FROM book (不复制重複的);
INSERT INTO book_copy SELECT * FROM book ORDER BY id LIMIT 2 ;(复制前2条)
不同库中的表进行复制
INSERT INTO eval.report_class_parent_score_interval SELECT * FROM eval_back.report_class_parent_score_interval; *(全部复制)
同理。。
增
INSERT INTO emp(id,name,gender,birthday,salary,entry_date,resume) VALUES(1,‘zhangsan’,‘female’,‘1990-5-10’,10000,‘2015-5-5’,‘goodgirl’);
删
DELETE from 表名 【WHERE 列名=值】
查
SELECT 列名 FROM 表名 【WHERE --> BROUP BY–>HAVING–> ORDER BY】
改
UPDATE emp SET salary=salary+1000 WHERE name=‘wu’;
SELECT selection_list /要查询的列名称/
FROM table_list /要查询的表名称/
WHERE condition /行条件/
GROUP BY grouping_columns /对结果分组/
HAVING condition /分组后的行条件/
ORDER BY sorting_columns /对结果进行排序/
LIMIT offset_start, row_count /结果限定/