Home » SQL & PL/SQL » SQL & PL/SQL » Syntax
Syntax [message #23658] Sun, 22 December 2002 23:00 Go to next message
arun
Messages: 67
Registered: January 2000
Member
Hi,

--------------------------
Table column constraint_name reference ref_constraint_name ref_table_name referance_column_name

Labour season_code CK1 FK FK_seaon_come Season_master season_code
-----------------------------------

Now my question is , while creating the table

what will be syntax

Specially how i'll use referance_constraint_name in syntax .

Could you please suggest me with complete syntax

Regards,

Arun
Re: Syntax [message #23665 is a reply to message #23658] Mon, 23 December 2002 12:49 Go to previous message
ctg
Messages: 146
Registered: July 2002
Senior Member
Here is an example, based on your message you care about the foreign key at the bottom.

CREATE TABLE dept
(deptno number(2)
CONSTRAINT dept_deptno_pk PRIMARY KEY
,dname varchar2(14)
,loc varchar2(13));

CREATE TABLE emp
(empno number(4)
CONSTRAINT emp_empno_pk PRIMARY KEY
,ename varchar2(10)
,job varchar2(10)
,mgr number(4)
...
,deptno number(2)
CONSTAINT emp_deptno_fk
REFERENCES dept(deptno))
Previous Topic: any way to sort the data in a table type
Next Topic: Can anyone help me code a simple function?
Goto Forum:
  


Current Time: Fri May 17 10:36:45 CDT 2024