INSERT data using INSERT a part of the complete row INSERT a part of the row INSERT multiple rows INSERT some query results INSERT a complete row first look at the original customer list: INSERT a row: INSERTINTOcustomersVALUES (NULL, PepELaPew, 10 INSERT data
Insert a part of the complete row insert multiple rows insert some query results insert the complete row first look at the original customer list:
INSERT a row: insert into mers values (NULL, 'Pep E. laPew ', '2014 Main Street', 'Los Angeles ', 'CA', '000000', 'USA', NULL, NULL );
Another way is to specify the column name. in this way, when the table structure changes, its SQL statement can still be used, and this assignment does not need to be the same as the original table structure.
INSERT multiple rows you can combine multiple INSERT statements:
INSERT... VALUES (,,,,);
INSERT... VALUES (,); in this way, you can INSERT two records. if the column names to be inserted are the same, you can merge the INSERT statements as follows:
Insert into name (,) // the same column name values (,) will be used for subsequent inserts of multiple records (,,,,,,,,,), (.........), (.........); // in this way, three records are inserted. Insert the retrieved data is to use the SELECT statement to retrieve the data and insert it into the table as the value of VALUES. the following SQL statement combines the custnew table into the customer table:
Insert into mers (cust_id, cust_contact, cust_email, cust_name, cust_address, region, cust_state, region) SELECT cust_id, cust_contact, upper, cust_name, cust_address, lower, cust_state, lower, cust_country FROM custnew;