Rabu, 03 Agustus 2016

[Step 02] How to use database & create a table in MySQL database



To practice how to create a table in the mysql database, we must first create a database in advance here we will use the database with the name 'becoding' you can make in advance. after the database is created we have to use the database with the command 'use database_name;', so to use the database 'becoding' we write command 'use becoding;'.
ScreenShot: Create and Use database [Click Here]
 

After the database is used, then we will make a table with the basic commands 'create table table_name (field1 type,...,fieldn type);', for example, we will create a table 'friend' that consists of the fields 'id' and 'name', which is the primary key field name. then the order of manufacture is 'create table friend (id char(6) primary key not null, name char(12) not null);'.
click to determine the type of data in MySQL and how to use 

ScreenShot: Create Table [Click Here]
After the table is made we still can look through the table structure with the basic commands 'desc table_name;' or 'describe table_name;', so simply write command 'desc friend;' or 'describe friend;'.



Okey, up here our first learning about learning mysql database. in the next post we will learn to modify the structure on a table. I hope this study can help you all.
Thank you for reading to the end.

Tidak ada komentar:

Posting Komentar