MySQL基础(持续更新中 ... )

1. 增删改查

1.1 数据库

1.1.1 创建数据库

create database db1 charset utf8;

1.1.2 修改数据库

alter database db1 charset gbk;

1.1.3 删除数据库

drop database db1;

1.1.4 查询数据库

show database;

show create database db1;

1.2 数据表

1.2.1 创建数据表

create table t1(a int,b char,c varchar);

1.2.2 删除表

drop table t1;

1.2.3 修改表结构

alter table t1 modify a float;

alter table t1 change a abc int;

alter table t1 add col1 int;

alter table t1 drop column col1;

1.2.4 查询表

select * from t1;

select * from t1 where a = 1 and b = 1;

select a,b,c from t1 where a = 1 and b >100;

猜你喜欢

转载自www.cnblogs.com/weige007/p/11903510.html