mysql使用语法(个人常用总结,待补充)

创建数据库
create database test_base;
使用数据库
use test_base
库中建表
create table test_table( name vachar(20), address varchar(20));
表中添加数据
insert into test_table values(“test”,“beijing”);
添加约束
alter table test_table add constraint pk primary key(name);
查询
select * from test_table;
修改
update test_table set address=“mianyang” where name=“test”;
删除
delete from test_table where name=“mianyang”;
删除数据表
drop table test_table;
删除数据库
drop database test_base;
退出 exit 或则 quit
修改表中的数据字段名字和类型:
alter table [表名] change [原来字段名] [新修改的字段名] [字段数据类型];
alter table students change 可借用书籍 可借用本数 varchar(20);
修改数据表名称、列名称,列的位置,类型(具体这个博客查看,十分详细)
https://blog.csdn.net/li787974136/article/details/82595142

具体所有语句:此博客十分详细,目录分级查看各种语法.
https://blog.csdn.net/Ace_2/article/details/85002791

猜你喜欢

转载自blog.csdn.net/weixin_43722571/article/details/95800636