I want to copy all the fields from the temp_sales table to sales table (after specific field). I want to do it quickest way as possible.. How to do this in SQL?
CREATE TABLE IF NOT EXISTS `temp_sales` (
`field1` varchar(10) NOT NULL,
`field2` varchar(20) NOT NULL,
`field3` varchar(20) NOT NULL,
`field4` varchar(50) NOT NULL,
`field5` varchar(50) NOT NULL,
`field6` varchar(50) NOT NULL,
`field7` varchar(50) NOT NULL,
`field8` tinyint(2) NOT NULL,
`field9` tinyint(2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13692 ;
In other word: There are some fields in the sales table. I want to add more new fields in the sales table from temp_sales (without data).
This is a 3-Step process:
.1. You need some unique or primary key field in
temp_sales, that links a row intemp_salesto the corresponding row insales(again via a unique/primary key).2. You need a DDL statement such as
.3. You need a DML statement such as