您的位置:首页 > 博客中心 > 数据库 >

MySql 常用命令

时间:2022-03-15 21:59

1.show databases   展示所有数据库

2.建表  

技术图片

 

 

column : 列名

PK:唯一主键

NN:不能为空

AI:自动增加

3.修改删除表 

技术图片

4.使用库 

技术图片

 

5.屏蔽 -- 加空格   切近加空格 

6.插入指定的表数据

技术图片

 

 

常用的增删改查 和 模糊搜索 排序 对应下面demo即可 

-- show tables;
-- insert into users(username,`password`,realname)values(‘zhangsan‘,‘123‘,‘张三‘); 
-- select * from users;
-- select id,username from users;
-- select * from users where username=‘zhangsan‘and `password`=‘123‘; 
-- select * from users where username=‘zhangsan‘or `password`=‘121‘; 
-- select * from users where username like‘%zhang%‘;
-- select * from users where password like‘%1%‘ order by id desc ;   

 

热门排行

今日推荐

热门手游