Data manipulation language
- 简写 DML
- 数据操纵语言
- 不包含SELECT
INSERT INTO
- 新增语句
指定字段添加
INSERT INTO STUDENT(ST_ID,ST_NAME,ST_SEX,ST_JOIN_DATE)
VALUES(0000001,'小琪','女','20-5月-18');
按照默认字段顺序添加
INSERT INTO STUDENT VALUES(0002,'冯二','男','30-5月-17','学习');
INSERT INTO STUDENT VALUES(0003,'旭升','男','23-5月-17',NULL);
指定当前会话时间格式并按照新格式添加
-- 修改当前会话时间格式
ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';
INSERT INTO STUDENT VALUES(0006,'布偶','男','2017-10-19 21:47:38','吃小鱼干');
UPDATE
- 更新语句
UPDATE STUDENT SET ST_HOBBIES='学习' WHERE ST_ID=5;
UPDATE STUDENT SET ST_HOBBIES='游泳' WHERE ST_ID=3 AND ST_HOBBIES IS NULL;
UPDATE STUDENT SET ST_HOBBIES=ST_HOBBIES||',游泳' WHERE ST_ID=4;
DELETE FROM
- 删除数据
DELETE FROM STUDENT WHERE ST_HOBBIES='学习';
网友评论