Database P3306
CREATE DATABASE [if not EXISTS] db_name [characterset GBK];
Use database;//Jump database
show databases;
Alert Database db_name Character Set utf8;//modified
drop databases [if not EXISTS] dbname;//Most useful
Show Create Databses dbname;
Table
CREATE TABLE [i n e] tbname (
ID smallint unsigned PrimaryKey auto_increment,
name varchar (TEN) is not NULL,
);
NOT NULL non-null auto_increment self-increment primary key unique key uniqueness constraint
default ' '
Describe[desc] Stu;
show tables;
Show CREATE table tbname;
Alert Table users1 add age tinyint unsigned not null default ten;
Alert Table Tbname Add colname coldef,...//Add multiple columns
Alert table tbname Add password varchar (+) NOT null after username//added after username
Alert Table Tbname add truename varchar (TEN) NOT null first//first
Alert table tbname drop password,drop age;//Delete multiple columns
int tinyint decimal (legth,dec) text char varchar//data type
Increase
INSERT INTO Tbname (collist) VALUES (val)
Delete
Delete from tbname where name=xx;
more
Update tbname set col= ' where xx=xx;
Check
Select ColName from Tbname where ... order by colname ASC default |desc descending limit 3,2
and and and OR or not
min Max sum avg count ()
MySQL Learning notes