기초/DBMS

[DBMS] Oracle SQL Tip

장동규 2017. 7. 12. 21:23

create table XXX(


constraint member_pk primary key(IDX)   >> select 

)


#TableSpace select

create user [ id ] identified by [ pw ] default tablespace [ table_space ] temporary tablespace [ table_temp ]; 

>> and alter

alter user [ id ] identified by [ pw ] default tablespace [ table_space ] temporary tablespace [ table_temp ];


#User Grant

grant connect, resource, create view to [ id ]; 



#Sequence >> mysql is auto increment

create sequence [ table ]_[ filed ]_seq;

insert table(filed) values([ table]_[filed]_seq.nextval );  // sequence next

drop sequence member_idx_seq; // sequence reset


시퀀스는 수정할수 없으므로 일련번호는 viewtable을 만들어서 따로 넣어주거나 rownum을 통해 count하는방법이 좋겠다.