lundi 25 mai 2015

How to insert multiple data to a table with auto_increment primary key column?

So I'm using SQLite 3.6 and tried to insert multiple data to my table which has 3 columns (1 AI PK) using

INSERT INTO 'tablename'
      SELECT 'data1' AS 'column1', 'data2' AS 'column2'
UNION SELECT 'data3', 'data4'
UNION SELECT 'data5', 'data6'
UNION SELECT 'data7', 'data8'

somehow it didn't work and I got this error

table transport_type has 3 columns but 2 values were supplied

Is there any other way to input multiple data?

Aucun commentaire:

Enregistrer un commentaire