//第一种在括号里分别填入对应的数据进行添加
-- INSERT INTO users (username,password) VALUES ('xxx','123456')
//第二种根据set 直接对应添加
-- INSERT INTO users SET username = 'xxx',password = '123123'
修改指定ID的内容
//修改单一属性
-- UPDATE users SET username = 'xx' where id = 1
-- UPDATE users set password = 'xx' where id = 1
//一次性修改全部内容
-- UPDATE users set username = 'xx',password = 'xx' where id = 1
删除指定ID的内容
-- DELETE from users WHERE id = 3
查询所有ID 某区域 的信息
SELECT * from users WHERE id < 11
根据 or或者 and并且 查询相关内容
查询 or是或者 and是并且.
-- select * from users where id < 3 or id > 6
-- select * from users where id > 2 and id < 5
查询关键字
查询关键字 模糊查询 likc查询以xx开始查询 在查询文字后面加% 例子:'星%'
如果查询以什么结束.在查询文字前端加% 例子 : '%星'
-- select * from users where username like '星%'
-- select * from users where username like '%星'
排序
-- ORDER BY id asc 默认ID从小到大
-- ORDER BY id DESC ID从大到小开始
-- select * FROM users ORDER BY id DESC
查询有多少数据
SELECT count(*) from users
查询指定的数据有多少条
SELECT count(*) from users where id > 1
根据AS取别名
//将 ID满足大于1的数据 count(*)名 通过AS 修改为total 方便后续操作.
SELECT count(*) AS total from users where id > 1