mysql中的增删改查
显示数据库中有的表格
SHOW TABLES
增
新建表格
CREATE TABLE urls(
id int,
url varchar(100),
description varchar(100)
)
插入值
INSERT INTO `chflvghu_test`.`user` (`user`, `password`) VALUES ('小红', 'qwerty');
插入多条数据
INSERT INTO `chflvghu_test`.`user` (`user`, `password`) VALUES ('小红', 'qwerty'),('小兰',123456),('小白',111111)
删
删除表格
DROP TABLE urls
删除值
DELETE FROM Person WHERE LastName = 'Wilson'
删除多条
DELETE FROM Person WHERE LastName in('a','b','c')
删除整张表
delete from user
改
update user set password='123456’ where name='小红';
查
查找所有
select *(所有) from user(表格名字)
查找部分属性
select host,user,password from user
查找符合要求的部分属性
SELECT host,password
FROM user
WHERE first_name ="Dirk"
AND country = "Cina"
SHOW TABLES
增
新建表格
CREATE TABLE urls(
id int,
url varchar(100),
description varchar(100)
)
插入值
INSERT INTO `chflvghu_test`.`user` (`user`, `password`) VALUES ('小红', 'qwerty');
插入多条数据
INSERT INTO `chflvghu_test`.`user` (`user`, `password`) VALUES ('小红', 'qwerty'),('小兰',123456),('小白',111111)
删
删除表格
DROP TABLE urls
删除值
DELETE FROM Person WHERE LastName = 'Wilson'
删除多条
DELETE FROM Person WHERE LastName in('a','b','c')
删除整张表
delete from user
改
update user set password='123456’ where name='小红';
查
查找所有
select *(所有) from user(表格名字)
查找部分属性
select host,user,password from user
查找符合要求的部分属性
SELECT host,password
FROM user
WHERE first_name ="Dirk"
AND country = "Cina"