文件名称:DBA常用SQL
文件大小:29KB
文件格式:TXT
更新时间:2017-06-29 03:55:43
DBA常用SQL
第一章:写简单的sql语句 SQL> alter user scott account unlock; SQL> alter user scott identified by tiger; SQL> conn scott tiger 1 使用算术操作符 SELECT last name salary salary + 300 FROM employees; 7 使用interval CREATE TABLE warranty prod id number warranty time INTERVAL YEAR 3 TO MONTH ; INSERT INTO warranty VALUES 123 INTERVAL "8" MONTH ; INSERT INTO warranty VALUES 155 INTERVAL "200" YEAR 3 ; INSERT INTO warranty VALUES 678 "200 11" ; SELECT FROM warranty; 8 使用extract函数 抽取 SELECT EXTRACT YEAR FROM SYSDATE FROM DUAL; 9 使用FROM TZ转化时间戳 SELECT FROM TZ TIMESTAMP "2000 03 28 08:00:00" "3:00" FROM DUAL; 通过查看v$reserved words可以查看oracle的保留关键字 drop table table name purge; 不经过回收站 drop table table name cascade constraints; 删除父表的时候把子表也删除(外健) with check option 该列有访问且值等(即条件一致) novalidate enable 约束">第一章:写简单的sql语句 SQL> alter user scott account unlock; SQL> alter user scott identified by tiger; SQL> conn scott tiger 1 使用算术操作符 SELECT last name salary salary + 300 FROM employees; 7 使用interval CREATE TABLE warranty prod id number warranty time [更多]