库相关的SQL
-
创建数据库:create datebase mydb1 character set gbk;
-
查询所有数据 show databases;
-
查看数据库详情 show create database mydb1;
-
删除数据库 drop database mydb1;
-
使用数据库 use mydb1;
表相关的SQL
-
创建表 create table mytable( id int primary key auto_increment) ;
-
查询所有的表 show tables;
-
查询表详情 show create table mytable;
-
查看表字段 desc
tablemytable; -
修改表名 rename
mytablemytable to table1; -
修改表引擎和字符集 alter table mytable engine innodb/myisam chatset utf8/gbk;
-
添加字段 alter table mytable add name int 默认不写/first/after xxx;
-
删除字段
delete from table mytable ;alter table mytable drop name; -
修改字段名称和类型 alter table mytable change gender sex int;
-
修改字段类型和位置 alter table mytable modify sex varchar(5) after name;
-
删除表 drop table mytable;
数据相关的SQL
-
添加数据
update from mydb where 什么条件;insert into mytable(name) values('八哥'); -
查询数据 select * from mydb where 什么条件;
-
修改数据
update from mydb where 什么条件;update mydb set name='' where name = '八哥'文章来源:https://uudwc.com/A/wo36V -
删除数据 update from mydb where 什么条件;文章来源地址https://uudwc.com/A/wo36V