操作文件夹(库)
- 增: create database 库名 charset utf-8;
- 查: show databases;
- 改: alter database db1 charset latin1; # 改变字符编码
- 删: drop database db1;
操作文件(表)
先切换到库下: use db1
查看当前所在库: select database();
- 增: create table t1(id int, name char);
- 查: show create table t1;
show tables; - 改: alter table t1 modify name char(16);
alter table t1 change name name1 char(2); - 删: drop table t1;
操作文件内容(记录)
- 增: insert t1(id,name) values(1, 'jie'),(2,'biao');
- 查: select * from db1.t1;
- 改: updata db1.t1 set name = 'sb' where id = 2;
- 删: delete from t1 where id = 2;