This article belongs to the small white entry level, if you have a master can skip directly
1. Run database mysqld.exe, client direct mysql-uroot (root is Default user name)-p
2 showdatabases,showtables;drop databases name, drop table name show Delete Library table
3 DESC Table Observation Table structure
4
CREATE TABLE test (ID int unsigned auto_increasement primary key,name varchar () NOT NULL default ' Lyz ');
Create a data table, the primary key unsigned self-increment, the name is not nul default, note that it is best to use varchar with varchar, because the size of the varchar is better than char
5 Increase
Insert into Test (name) value ('QLL');
If the ID set the primary key self-increment, you can not write, of course, if the name is not worth the default Lyz
6 by deleting
Delete from test where name= ' QLL '
If there is no where then the entire table is emptied, where as far as possible with the ID, reduce the index, with where the best index, because if there is an index is once, there is no loop
7 Change
Update Set name='ql'where name='QLL ';
This column is updated if no where is added;
8 Check
Select * from Test;
This can be a specific name for each field;
9. Function (random, limit, count)
Select * fromTest limit1, 2 This is the output from the first fewSelect * fromTestOrder byIddescFlashbackSelect * fromTestOrder by Rand() Random sortSelect *FCount(*) asTotal ROM test input and count the number of people
Ten where can be combined with in,and greater than, less than used together
11 Changing a table field
table Test varchar(table Test change name varchar (table Add Index Table drop index name;
Class 12 queries and regular queries
Select * from where like '%q%'; Note like query to add %Select*fromwhere name Reqexp ^Q '; regular query, but not recommended, the speed is not good
13 Grouping and aggregation
Select * ,count(*) as from Group by name, grouped by name field, There must be a count aggregation for the grouping, otherwise all data will be compressed into one
14 Left Connection
Select user. Name, Post.title from the left joinonuser = post.id // Note that on the left connection, on is not where or having
15 Database Permissions
Grant Select on *.* toUser1@192.168.1Idemntified by '123' //authorized to checkGrant All on *.* toUser1@192.168.1Idemntified by '123'//Authorize all permissions
16 want to put the log in this article, but later wanted to log already belong to the high-level content, temporarily not too skilled, ready to wait, and master-slave copy, and put together
MySQL Common statement Getting started finishing