Insert a separate full line, insert a separate section line
INSERT intocustormersVALUES(NULL, 'Pep E. Lapew', 'Main Street', 'Los Angeles', 'CA', '90046', 'USA', NULL, NULL);
...... The above SQL statement relies heavily on the order in which the columns are defined in the table. It also relies on the order in which information is inserted. Even if you can, there is no guarantee that the next time the table is refactored, the columns remain in exactly the same order. ......
INSERT intoCustomers (Cust_name, cust_address, cust_city, Cust_state, Cust_zip, Cust_country, Cust_contact, Cust_email)VALUES('Pep E. Lapew', 'Main Street', 'Los Angeles', 'CA', '90046', 'USA', NULL, NULL);
- Because column names are provided, values must match the column names in the order specified, rather than in the order in which the columns appear in the Performance table. The advantage of this is that, even if the table structure changes, the INSERT statement will still work correctly.
...... Regardless of the INSERT statement you are using,the number of values must be correct . ...... With this syntax, columns can be ignored. This means that only some columns are provided with values, while the other columns do not. (cust_id is ignored when column names are displayed)
- Ignore column : The Ignore column must meet one of the following criteria: The column is defined as a null value (no value); A default value is defined by the table. (meaning that if you do not specify a value for the column, it is the default value)
The SQL statement that creates the table is posted here:
CREATE TABLE' Apppowerinfo ' (' ID ')int(Ten) unsigned not NULLAuto_increment COMMENT'self-growing ID', ' Createtime 'int(Ten) unsigned not NULL DEFAULT '0'COMMENT'when the record was created', ' UpdateTime 'int(Ten) unsigned not NULL DEFAULT '0'COMMENT'time of latest update record', ' EndTime 'int(Ten) unsigned not NULL DEFAULT '0'COMMENT'Expiry Time', ' validity 'tinyint(4) unsigned not NULL DEFAULT '1'COMMENT'Validity: 0: invalid; 1: valid;', ' remark 'varchar( -) not NULL DEFAULT "'COMMENT'Notes', PRIMARY KEY(' id ')) ENGINE=InnoDB auto_increment=2 DEFAULTCHARSET=UTF8;
Note which:
not NULL DEFAULT ' 0 '
Low_priority
If data retrieval is more important (and often so), you can reduce the priority of the INSERT statement by MARIADB:
INSERT into
Topics to be continued in this section
- Inserting multiple lines
- Inserting the retrieved data
MariaDB SQL Insert Data