MySQL基本使用
2022-01-20 本文已影响0人
我家有个王胖胖
一:
1.1什么是数据库有

1.2常见数据库分类

二:
2.1创建数据库

2.2创建数据库表

2.3表字段数据类型和字段的图书标识

三:sql语句
3.1查询

SELECT * FROM my_db_01.users;

select username,password from my_db_01.users;

3.2插入

insert into my_db_01.users (username,password) values ('tony stak','aaa321')

3.3修改

//将id为4的用户密码修改为tony123
update users set password = 'tony123' where id = 4;

//将id为2的用户密码修改为111111,状态为1
update users set password = '111111', status = 1 where id =2;

3.4删除

//删除id为4的用户
delete from users where id = 4;

3.5where子句
3.5.1语法

3.5.2可在where子句中运用的运算符

3.6 and 和 or

3.7 order by

//升序(默认)
select * from users where status <> 1 order by id

//降序
select * from users where status <> 1 order by id desc
