Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to define Foreign Keys

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to define Foreign Keys
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: 287
Location: Basel, Switzerland

PostPosted: Sat Apr 01, 2006 5:13 pm    Post subject:
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    Post subject: Re: FOREIGN KEYS
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts VSAM define for large file jerryte JCL & VSAM 9 Wed Oct 05, 2016 1:51 am
No new posts Joinkeys with duplicated keys juares castro SYNCSORT 19 Fri Sep 23, 2016 5:58 am
No new posts How to define PCB for paired segments ashok_uddaraju IMS DB/DC 4 Tue Jun 14, 2016 11:40 pm
No new posts Define Alias for multiple Data sets u... sandy98669 JCL & VSAM 4 Fri May 27, 2016 1:07 pm
No new posts trying to define a VSAM Cluster in JCL t5590ag JCL & VSAM 10 Thu May 19, 2016 5:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us