If the table category has two collumns "id" and "name", where id was specified as AUTO_INCREMENT (so whenever you insert a new record into the table - and don't explicitly set the value of the primary key - the SQL engine sets it for you) then we can enter multiple values at onde like this:
INSERT INTO `category` (`name`) VALUES ('dairy'),('meats'),('bakery'),('fruit & veg');
Insert example:
INSERT INTO `product` (`name`, price, description, category_id) VALUES ('milk', 1.70, 'semi skimmed (1L)', 1);
Sem comentários:
Enviar um comentário