How to insert data into MySQL Table - MySQL Developer Tutorial

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

2 comments:

  1. Jaa Lifestyle is a money earning website which has its roots from United Kingdom. The Jaa Lifestyle not fully open in India, but still an individual can try to get a glance about services from website. They offer some new ways to earn money by involving the individuals in different activities. There are referral programs and other game in Java Lifestyle, which are available to earn money. Jaa Lifestyle Login Id And Password Individual has to fully get involve in the activities and has to win the game to earn money. In the modern time, everyone addicted to digital devices and Jaa Lifestyle tries to attract such users to use these websites and earn money. Here 25penny will provides you the detail steps for Sign up and login.

    ReplyDelete