Command on The MYSQL by Sebastian Mandai

What is MySQL?
MySQL is one type of database server that is very famous for its popularity due to MySQL using SQL as the language basis to access the database. In addition, it is Open Source (you do not have to pay to access them) on various platforms (except for type enteprize, which is commercial).MySQL including the type of RDBMS (Relational Database Management System), which is why the term table, columns, and rows are used in MySQL. In MySQL, a database containing one or more columns and rows contain multiple columns, the term table, rows, and columns can be seen from the practice later ... ..!!!.

Preparation:- The first computer already exists mysql- Be careful.

1. Set the root password
The command to give the password is:
Mysqladmin-uroot password [name of the password]
Example:
Mysqladmin-password uroot mandai

2. Opening MySQL from dosOpen up the dos and typing this command:
Mysql-u root-p
And as it appears
Enter password:
Enter your password you provided.
3. Creating a database
how to create a database by typing the following command:
mysql> create database [database name];
For example:
mysql> create database smk_labor;

4. Enabling a database that was createdEnter this query command:
Mysql> use [database name]
Example:
Mysql> use smk_labor;Database changed
The word changed this database is a message that means that you have enabled database that you created.

5. How to view a list of tables
Typing the command beriku:
Mysql> show tables from mysql;
So this command will display a list of mysql table

6. How to create table to database
The syntax or command such as:
Mysql> create table [table name] ([Column a] [type] [width],[Column b] [type] [width],... ... ... ... ... .... ... ....,[Column n] [type] [width]);Remember a command that has been completed typed must end with a semicolon [;]Example:
Mysql> create table teacher (nip char (5) not null,name varchar (35) not null,gender enum ('p', 'w')religion varchar (15) not null,);Query ok, o rows affected (0:36 sec)
After that you can still see a series of tables that you can do:By typing the command
Mysql> desc teachers;
Then he will display a table of teachers along with the circuit.

7. Using alter command
Here is perintag ddI alter command used to perform a design change table to table with the new structure.
Type the following command:
Mysql> alter table [table name]Change [data yanga ingiin modified]Query ik, 0 rows affected (0.70 sec)
Example:
Mysql> alter table teacherChange expertise graduates varchar (1 -) not null;Query ik, 0 rows affected (0.70 sec)
So the field name will be changed to graduate skills.
8. Entering data into tablesType the following command:
Mysql> insert into [table name] ([column a, column b, column n]) values ​​([isi_kolom a, isi_kolom b, ... ..., isi_kolom n]);


Example:
Mysql> insert into teacher (nip, name, sex, religion)Values ​​('10023 ',' mind ',' male ',' Islam ');Query ik, 0 rows affected (0.70 sec)
9. Command to see tables
The following table meliha command
Mysql> SELECT * FROM [table name];
Example:
Mysql> select * from teachers
The purpose of this star symbol is a table showing all the contents from nip to graduate.
If you want to show both the name and religion only data type the following command:
Mysql> SELECT [column a, column b] from [table name];
Example:
Mysql> select name, religion from a teacher;


10. Delete the contents table
The following command syntax:
Mysql> delete from [table name] WHERE [column / content you want to delete]
Example:
Mysql> delete from teachers' WHERE field = 'name';Query ik, 0 rows affected (0.70 sec)


Thus the command - the command query that I know ... ..Hopefully you can do it themselves ...

0 komentar:

Posting Komentar

Followers

 

MandaiPC Copyright © 2011-2012 | Powered by Blogger