数据库基本操作
查看、选择数据库: show databases; use ;
创建数据库:create database character set ; character set按照指定格式编码
删除数据库:drop database ;
数据表基本操作
查看表:show tables
查看表结构:describe ;
查看表中数据:select * from limit ;
建表:create table ( ,
字段名称> , primary key(,) engine = myisam);#红字指定联合主键
表中插入记录:insert into (字段名1,字段名2)
values(字段1的值,字段2的值),
(字段1的值,字段2的值);
删除表:
drop table ;
修改数据表:
增加字段 alter table add after ; after 在指定位置后增加字段
删除字段 alter table drop ;
表重命名 alter table rename ;
表字段重命名 alter table change ;
修改数据类型 alter table modify ;
修改主键 alter table drop primary key, alter table add primary key('主键名');
删除表中记录 delete from where ;
修改表中记录 update set where ;
2020-03-09 20:41