Inserting multiple rows in MySQL Table in Single Statement - MySQL Developer Tutorial

Inserting multiple rows in MySQL Table in Single Statement 

If you need to insert multiple rows of data into MySQL Table, you can use below syntax.

insert into TableName
Values (ValueForColumn1,ValueforColumn2,....),

Example : 

In below example, we are creating customer table and then insert multiple rows into customer table by using single insert statement.

create customer table syntax:

CREATE TABLE `customer` (
  `idcustomer` int(11) NOT NULL auto_increment,
  `firstname` varchar(50)  NULL,
  `lastname` varchar(30)  NULL,
  `age` int(11) DEFAULT NULL,
  `phonenumber` char(11) DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `gender` char(1) NOT NULL,
  Constraint pk_idcustomer Primary key (idcustomer)

) ;

Insert multiple rows in MySQL Table.

insert into customer

Insert Multiple records in MySQL table in single Insert Statement - MySQL Tutorial

1 comment:

  1. Hi everyone. I've been using Whit-Label Card Issuing for several years now, and every time it pleasantly surprises me with its functionality and reliability. It is the perfect solution for those who want to keep their finances under control. The ability to synchronize with bank accounts and credit cards allows you to automatically track transactions, which saves a lot of time. And the budget planning and goal setting features help you keep your financial goals in sight and achieve them.