例如,现在服务器上有数据库 dbx 和 dby,dbx中有很多表,要把dbx中的表全部复制到dby,如下操作: 首先: use dby; [复制表结构] CREATE TABLE user LIKE dbx.user [复制旧表的数据到新表] INSERT INTO user SELECT * FROM dbx.user [原文] http://blog.csdn.net/tengyang11/article/details/5963913 1.复制表结构及数据到新表CREATE TABLE 新
1.临时表CREATE TEMPORARY TABLE test2( id INT ) SELECT *FROM test2 SHOW TABLES; INSERT INTO test2 VALUES() DROP TABLE test2 2.复制表结构(先show create table test 获取 sql,然后用sql创建新表) 3.复制表的数据到新创建的表INSERT INTO test2 SELECT *FROM test
1,导出远程数据库数据到本地 mysql -A wj_sms -h192.168.1.105 -uroot -p4321 -ss -e "set NAMES 'utf8';SELECT * from sys_role limit 300;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > apps.csv[注],oracle取前几条数据语句select * from user_tables where
比较两个数据表的结构 SELECT column_name, max( CASE WHEN table_name = 'table1' AND table_schema = 'db1' THEN 'Yes' END ) AS in_table_1, max( CASE WHEN table_name = 'table1' AND table_schema = 'db2' THEN 'Yes' END ) AS in_table_2 FROM information_schema. COLUMNS
创建表结果和数据准备[直接执行即可] /* Navicat MySQL Data Transfer Source Server : ftl1012 Source Server Version : 50617 Source Host : localhost:3306 Source Database : test_python Target Server Type : MYSQL Target Server Version : 50617 File Encoding : 65001 Date: 20