Mega Code Archive

 
Categories / MySQL / Table Index
 

Insert data without column names

mysql> mysql> CREATE TABLE prints     -> (     ->   id     INT             NOT NULL,     ->   code   VARCHAR(8)      NOT NULL,     ->   name   VARCHAR(20)     NOT NULL,     ->   PRIMARY KEY(id)     -> ); Query OK, 0 rows affected (0.00 sec) mysql> mysql> # insert 3 records into the "prints" table mysql> INSERT INTO prints VALUES     -> (     ->   1, "624/1636", "SQL"     -> ); Query OK, 1 row affected (0.00 sec) mysql> mysql> INSERT INTO prints VALUES     -> (     ->   2, "624/1904", "Hill Town"     -> ); Query OK, 1 row affected (0.00 sec) mysql> mysql> INSERT INTO prints VALUES     -> (     ->   3, "624/1681", "database"     -> ); Query OK, 1 row affected (0.00 sec) mysql> mysql> # show all "prints" data mysql> SELECT * FROM prints; +----+----------+-----------+ | id | code     | name      | +----+----------+-----------+ |  1 | 624/1636 | SQL       | |  2 | 624/1904 | Hill Town | |  3 | 624/1681 | database  | +----+----------+-----------+ 3 rows in set (0.00 sec) mysql> mysql> # delete this sample table mysql> DROP TABLE prints; Query OK, 0 rows affected (0.00 sec)