first of all, to popularize the simple way to install MySQL:yum
Yum Search MySQL (find out what's on MySQL)
3 items to install after finding
Mysql.i386
Mysql-server.i386
Mysql-devel.i386
Service mysqld start after installation (start MySQL service)
Go to MySQL
Mysql-h-U root-p
Password directly enter the beginning of the password is silent, you can change the password in MySQL or create an account and other operations
MySQL's SQL statement is broadly divided into 4 types
DDL (definition Statement)
Create
Create DATABSE (Establishment database)
Example: Create Database Jasondb (creates a database called jasondb)
* The created database must be selected to create a new form inside
-Use a space + database name in the way.
Example: Use Jasondb
View existing database syntax is show databases;
CREATE table (Column Name fields as field properties);
Example: CREATE TABLE Jason (column Name field); (Creating a table named Jason Plus content)
Drop
Drop database name (deleted databases)
Example: Drop database jasondb;
drop table name (delete table name)
Example: Drop table Jason;
Alter
ALTER TABLE table name
1. Alter....add
-ALTER TABLE name add new Column Name field Type Fields property
Example: Alter TABLE Jason add stuid (new list) int (field type) NOT NULL default (field property);
* Field Name field type and field properties must not be converted sequentially in order.
2. Alter....drop
2.1-alter table name drop column name;
Example: ALTER TABLE Jason drop STUID;
2.2-alter table Name drop index column name; (delete unique)
Example: ALTER TABLE Jason DROP INDEX stuid;
2.3-alter table Name drop PRIMARY KEY (primary key list name); (Delete primary key)
Example: ALTER TABLE Jason drop PRIMARY key stuid;
3. alter....modify(change all attribute types except list name)
Example: ALTER TABLE Jason Modify column name type attribute;
4. Alter....change(can change all existing lists)
Example: ALTER TABLE JAson change old column name new column name type attribute;
DML (Management statement)
Update
Update: Set: where
Update table name set field name = new value where condition;
Example: Update jaosn set stuid=1 WHERE condition = content;
Update table name set field name = new value order By field limit number of rows (updated sequentially qualified rows)
Example: Update Jason set stuid=1 ORDER by Stuid limit 5;
Delete
Delete: From.. where
Delete from table name where condition;
Example: Delete from Jason where stuid=1;
Delete from table name order BY field limit line number;
Example: Delete from Jason order by Stuid limit 5;
Insert
Insert INTO ... () values ();
Insert into table name (option) VALUES (' ', ' ', ' ', ');
This article from "11094147" blog, declined reprint!
Orecle Mysql Basic SQL Statement DDL & DML Introduction and summary by ICE Glass