How to insert data into MySQL Table
To insert the data into MySQL Table, below syntax can be used.
insert into TableName
(Column1,Column2,....)
Values (ValueForColumn1,ValueforColumn2,....);
Example:
Let's say we want to create customer report and then insert a row into customer table. we can use below statements.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 a row in customer table.
insert into customer
(firstname,lastname,age,phonenumber,dob,gender)
values
('Aamir1','Shahzad1',39,'505-4140000','1970-01-01','M');
Insert data into MySQL Table by using Insert statement - MySQL Tutorial
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.