create database db1 charset utf8;
# 查看当前创建的数据库 show create database db1; # 查看所有的数据库 show databases;
alter database db1 charset gbk;
drop database db1;
use db1; #切换文件夹 select database(); #查看当前所在文件夹
create table t1(id int,name char);
#查看当前的这张t1表 show create table t1; # 查看所有的表 show tables; # 查看表的详细信息 desc t1;
# modify修改的意思 alter table t1 modify name char(6); # 改变name为大写的NAME alter table t1 change name NAMA char(7);
# 删除表 drop table t1;
# 插入一条数据,规定id,name数据leilei insert t1(id,name) values(1,"mjj01"),(2,"mjj02"),(3,"mjj03");
select id from db1.t1; select id,name from db1.t1; select * from db1.t1;
update db1.t1 set name='zhangsan'; update db1.t1 set name='alex' where id=2;
delete from t1; delete from t1 where id=2;