DML(数据操作语言,它是对表记录的操作(增、删、改)!)
插入数据
INSERT INTO 表名(列名1,列名2, ...) VALUES(列值1, 列值2, ...)
修改数据
UPDATE 表名 SET 列名1=列值1, 列名2=列值2, ... [WHERE 条件]
2. 运算符:
算术运算符:+,-,*,/,%
赋值运算符: =
关系运算符:=,!=(不等于),<>(不等于),>=,<=,<,> ....
逻辑运算符:and,or ,not(用于链接多个条件)
update colin set age = 40 where number = '1001';
update colin set age = 34 where number ! = '1001';
update colin set age = 13 where number <> '1003';
update colin set age = 3 where number > '1003';
update colin set age = 12 where number <'1003';
update colin set age =11 where number >='1003';
update colin set age = 44 where number <='1003';
update colin set age =age+2 where age<=45 and age > 15 范围
BETWEEN...AND
update colin set age =110 where age between 20 and 50;
范围【前后范围都包括在
OR
update colin set age = 120 where number = '1002' or number ='102';只要满足其中一个条件就可以了
update colin set age = 120 where number in('1002','1003');
只要包含在小括号内的条件满足就可以执行
删除数据
DELETE FROM 表名 [WHERE 条件];
delete from colin where name='Chen';
删除 来自一张表 按照什么条件来删除
delete from 表名;
只是把全部的数据删除了
drop table 表名
将整个表都删掉了