Create A New Table
The database can not be separated from the table. here I'll make a tutorial how to create tables and fill the table. How to create table is the first we have to enable MySQL formerly in command prompt. enable MySQL is MySQL I described in myprevious post. Once we activate MySQL create a new database according to aposting I described in MySQL. Well now it is time we created the table by writing syntax :
mysql> create table siswa > ( NIS char(4) not null primary key, > Nama_siswa char(20), > Alamat char(30));
The database can not be separated from the table. here I'll make a tutorial how to create tables and fill the table. How to create table is the first we have to enable MySQL formerly in command prompt. enable MySQL is MySQL I described in myprevious post. Once we activate MySQL create a new database according to aposting I described in MySQL. Well now it is time we created the table by writing syntax :
mysql> create table siswa > ( NIS char(4) not null primary key, > Nama_siswa char(20), > Alamat char(30));
Query OK, 0 row affected (0.04 sec).
Display as follows :
If you want to see table then type in the syntax :
mysql> show tables;
Display as follows :
Insert Into Table
Once we create a table, and now it's time for us to fill the table according to what we want. How to fill our table using the insert syntax, which is written as following :
mysql>insert into siswa values
>('1234','Toni','Lumajang'),
>('1235','Hashi','Bekasi'),
>('1236','Khoirul','Bekasi');
If no errors then there will be a message :
Query OK, 3 rows Affected ( 0.05 sec )
Record : 3 Duplicates : 0 Warnings : 0
Display as follows :
if you want to see the contents of the table, type this the syntax :
mysql> Select* from siswa;
and you will get a display like this :
That's how to create tables and populate tables using MySQL. in the next post willmake a way to manipulate tables using MySQL.
*Thanks to Orang tua saya yang telah mengajari saya arti kemandirian dan mengajari saya semua arti hidup saya.
*Thanks To Om n Tante yang telah memberikan saya sarana.
0 komentar:
Post a Comment
NgomeL aja disini..!!