Syntax for Creating Table with Primary Key and Foreign Key

Create Table with Primary Key

SQL >create table tab1
(
 n1 number not null,
 constraint PK_TAB1 primary key (n1)
); 

Table created.

SQL >

Create Table with Both Primary Key and Foreign Key

SQL >create table tab2 (
n2 number NOT NULL,
n1 number,
constraint PK_TAB2 Primary Key (n2),
constraint FK_tab2 foreign key(n1) references TAB1(n1)
 );

Table created.

SQL >

No comments:

Post a Comment

ASM and Database does not auto start in Oracle restart environment (After Server start)

 If you are supporting Any Oracle restart environment and if you notice that your ASM instance and Database instance does not start automati...