Oracle常用Sql语句进行总结

来源:互联网 发布:苹果mac输入法不好用 编辑:程序博客网 时间:2024/04/29 20:15

1因各种各样的原因,事隔有点久,但愿总结顺利,总结分几块,如果各位有好的见议,请向我提出来,在此谢过!

2下面对Oracle常用的Sql语句进行总结:

--1表空间的创建与删除 --2表的创建与删除--3表的增加,删除,修改--4格式化时间等--5这个记不清楚了,在plsql中sql.window中会报没有值插入,在Command.window中执行show off就可以在这个窗口中执行插入--6表与表之间的联合查询--7索引的增加与删除--8外键,主键--9视图焦点实习的时候没有用到,不过曾经好像在哪里用过,在这做个总结 --10以上所做的在plsql一大部分是可以在界面上实现的,不过还是要记得的,万一公司只能允许你写sql也不至于什么都不会。--sql语句规范写法--删除分类表drop table sshe.HYL_BOOK_CLASS--创建分类表create table sshe.HYL_BOOK_CLASS(ID            NUMBER(10) not null,NAME          VARCHAR2(50) not null,DESCRIPTION   VARCHAR2(200) not null);--Add comments to the tablecomment on table sshe.HYL_BOOK_CLASSis '图书分类';comment on table sshe.HYL_BOOK_CLASS.IDis '图书分类id';comment on table sshe.HYL_BOOK_CLASS.NAMEis '图书分类描述';comment on table sshe.HYL_BOOK_CLASS.DESCRIPTIONis '图书分类描述';--Create/Recreate primary,unique and foreign key constraints(ken'streint 强制,限制,约束 )alter table sshe.HYL_BOOK_CLASSadd constraint PK_HYL_BOOK_CLASS primary key (ID);--创建索引create index IDX_HYL_BOOK_CLASS_01 on sshe.HYL_BOOK_CLASS(DESCRIPTION);alter table sshe.HYL_BOOK_CLASSadd constraint IDX_HYL_BOOK_CLASS_02 unique(NAME); --主键序例化create sequence S_HYL_BOOK_CLASS_01 on sshe.HYL_CLASS minvalue 0 maxvalue 9999start with 0 increment by 1 cache 20;--简单增删改查select * from sshe.HYL_BOOK_CLASS  hbc where hbc.id=0; insert into  sshe.HYL_BOOK_CLASS   values(1,'文学','文学是什么东西??');update sshe.HYL_BOOK_CLASS   hbc  set hbc.name='理科' where hbc.id=0;delete from sshe.HYL_BOOK_CLASS hbc where hbc.id=0;

今天就写到这!


0 0