标签:date 语句 详细 tables data update 改变 charset from
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 NAME 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;
标签:date 语句 详细 tables data update 改变 charset from
原文地址:https://www.cnblogs.com/russellyoung/p/mysql-xue-xi1--ji-benmysql-yu-ju.html