Oracle 学习笔记
2020年3月27日13:19:20
数据类型
NUMBER类型
NUMBER[(P[,M])];
++P表示精度,M表示小数点的位数++
1 |
|
DATE类型
1 |
|
LOB类型
1 |
|
ROWID和ROWNUM伪列
1 |
|
ALTER操作
1 |
|
1 |
|
1 |
|
student更新到student2
INSERT INTO student2 SELECT * FROM student;
is null
SELECT * FROM student t WHERE t.sname IS NULL;
DELETE、TRUNCATE和DROP区别
1 |
|
创建成绩表
1 |
|
给grade插入测试数据
1 |
|
提交
COMMIT;
查询数据
SELECT * FROM STUDENT;
SELECT * FROM GRADE;
ORDER BY 排序
SELECT * FROM GRADE t ORDER BY t.sno DESC;
UNION、UNION all 、MINUS 、INTERSECT
SELECT 1 FROM dual UNION SELECT 1 FROM dual; –去重
SELECT 1 FROM dual UNION ALL SELECT 1 FROM dual; –合并
SELECT * FROM student MINUS SELECT * FROM student t WHERE t.sno = ‘0’ –相减
SELECT * FROM student INTERSECT SELECT * FROM student t WHERE t.sno = ‘0’ –取交集
TABLE、COLUMN重命名
RENAME student TO newstudent; –>table 重命名
ALTER TABLE newstudent RENAME COLUMN sno TO newsno; –>column 重命名
UPDATE操作
MySQL update语法
UPDATE user SET PASSWORD = PASSWORD(‘root’) WHERE User = ‘root’;
Oracle update语法
UPDATE USER set PASSWORD =(‘root’) WHERE User = ‘root’;
UPDATE STUDENT t SET t.sno = (‘0’) WHERE t.sno = ‘1’
SELECT t.*,t.rowid from STUDENT t –查询
创建用户及用户表空间、授权
1 |
|