IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to define Foreign Keys


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ysuryawanshi_mcs
Warnings : 1

New User


Joined: 25 Mar 2006
Posts: 15
Location: pune(India)

PostPosted: Sat Apr 01, 2006 4:30 pm
Reply with quote

HOW TO DEFINE FOREIGN KEYS

WARNING: TITLE EDITED
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Sat Apr 01, 2006 5:13 pm
Reply with quote

hy ysuryawanshi_mcs,

while creating any table, you can define foreignkeys
pointing to the depending table.

1. define the foreignkeys as fields in your table

2. after the columns, you define the foreignkeys clause
--> almost the same, if you define a primary key clause...

martin9
Back to top
View user's profile Send private message
perez_a

New User


Joined: 02 Feb 2006
Posts: 25
Location: Italy

PostPosted: Wed Apr 05, 2006 4:56 pm
Reply with quote

HI ysuryawanshi_mcs,
HERE U ARE AN EXAMPLE:

CREATE TABLE EXAMPLE
( EXA_NAME CHAR(10)
EXA_SEX CHAR(1)
CONSTRAINT
FK01 FOREIGN KEY (EXA_NAME)
REFERENCES ANAGRAPH (ANA_NAME)
);

WHERE ANAGRAPH IS A TABLE JUST CREATED AND ANA_NAME IS PRIMARY KEY FOR IT.
HAVE A NICE DAY perez_a
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts Use input file with OMIT rcd keys? DFSORT/ICETOOL 15
No new posts Any JCL or VSAM Utility to get number... JCL & VSAM 1
No new posts Define default volume for DSN storage... JCL & VSAM 8
No new posts define 1 DCB parms for multiple outpu... JCL & VSAM 9
Search our Forums:

Back to Top