Jumat, 12 Agustus 2016

[Step 05] how to enter and display data from the table mysql

 In this post we will learn to enter data into a table in the mysql database, and displays the data that has been entered.

Insert data into the table
to enter data in the mysql command used is the 'Insert'.

with formula writing:
insert into table_name (field[1],field[2],..,field[n]) values(datafield[1],datafield[2],..,datafield[n]);
or
insert into table_name values(datafield[1],datafield[2],..,datafield[n]);

a previous tutorial we already have a database 'decoding' and in it contains the table
'Friend' as follows:

ScreenShot: Desc friend [Click Here] 
 
then the presumption we will menginsert the following data:
id: 001
friend_name: Franky
id: 002
friend_name: risa kawai


when using the formula of the first to enter the first data, it can be written as follows
insert into friend (id,friend_name) values ('001','franky');
whereas if you use the second formula to enter data into two, then writing is
insert into friend values ('002','risa kawai');
ScreenShot: Insert Data [Click Here]

Displays the data in the table
to check the data has been inserted or not you can use the command 'select', By writing:
select * from table_name;
notes:
* -> all fields
then to check whether the data was already on the table to insert a friend then the command is
select * from friend
ScreenShot: Select table [Click Here]

That explanation on how to enter and display data in a table in mysql,we thank you for visiting and reading to the end. hopefully this article can be useful and helpful to you all.

Tidak ada komentar:

Posting Komentar