- Create database: capital letters are keywords; options in [] are optional options;
CREATE DATABASE [IF NOT EXISTS] db_name [create_specification [, create_specification] ...]
Use validation rules when creating libraries
utf8_general_bin : case sensitive
utf8_general_ci : case insensitivecreate table
create table 表名(
字段1 列类型1,
字段2 列类型2,
...
字段n 列类型n );
- insert data into the table
insert into 表名(字段名1, 字段2, ...) values(values1, value2);
- View the data in the table
select * from 表名
- Check the character sets supported by the database
show charset;
- View the statement to create the database
show create database 数据库名;
- delete database
DROP DATABASE [IF EXISTS] db_ name;
For example, delete the test database
- database modification
ALTER DATABASE [IF EXISTS] db_name [alter_spacification [,alter_spacification]...]
Note: The modification of the database is mainly aimed at the character set and verification rules of the approval database
- table modification
ALTER TABLE tablename ADD (column datatype [DEFAULT expr][,column datatype]...);
ALTER TABLE tablename MODIfy (column datatype [DEFAULT expr][,column datatype]...);
ALTER TABLE tablename DROP (column);