数值型 整数 tinyint smallint mediumint int bigint 小数 float double decimal mumeric字符串 存储字符串 char varchar text 存储二进制 binary varbinary blob日期时间 date time datetime timestamp
create database 数据库名称;# 设置数据库字符集create database 数据库名称 default character set = 'utf8';
use 数据库名称;
create table 数据表名称( 列名 数据类型(长度), 列名 数据类型(长度), .........)character set utf8 collate utf8_general_ci;
show databases/tables;
# 1.修改表格名称 alter table 原表名 rename to 新表名;# 2.修改列 alter table 原表名 change(motify) 原列名 新列名 类型 长度;# 3.新增列 alter table 原表名 add 新列名 新类型 新长度;# 4.删除列 alter table 原表名 drop 原列名;
drop table 数据表名;drop database 数据库名;
insert into 数据表名 (列名, 列名, 列名) values (值,值,值),(值,值,值)....(值,值,值);insert into 数据表名 values (值,值,值),(值,值,值)....(值,值,值);
select 列名,列名,列名.... from 数据表名;select * from 数据表名;
delete from 数据表名;
update 数据表名 set 列=值,列=值;