Question: I am trying to Create a foreign key table using the tables below. I also have provided an example in bold of the format I

I am trying to Create a foreign key table using the tables below. I also have provided an example in bold of the format I am looking for..

-------------------------------------------------------------------

-- Child Parent Column(s)

-- ----- ------ ---------

-- 1 TStoreCashiers TStores intStoreID

-- 2 TStoreCashiers TCashiers intCashierID

-- 1

ALTER TABLE TStoreCashiers ADD CONSTRAINT TStoreCashiers_TStores_FK

FOREIGN KEY ( intStoreID ) REFERENCES TStores ( intStoreID );

-- 2

ALTER TABLE TStoreCashiers ADD CONSTRAINT TStoreCashiers_TCashiers_FK

FOREIGN KEY ( intCashierID ) REFERENCES TCashiers ( intCashierID );

->> please note that * = PK for that tabe

TStudies

intStudyID* (1,2)

,strStudyDesc

TSites

intSiteID * (1,2,3,4, etc.)

,intSiteNumber (101, 102, 103, etc.)

,intStudyID

,strName

,strAddress

,strCity

,strState

,strZip

,strPhone

TPatients

intPatientID * (1,2,3,4, etc.)

,intPatientNumber (101001, 102001, etc)

,intSiteID

,dtmDOB

,intGenderID

,intWeight

,intRandomCodeID allow Nulls

TVisitTypes

intVisitTypeID * (1,2,3)

,strVisitDesc (Screening, Randomization, Withdrawal)

TVisits

intVisitID * (1,2,3,etc.)

,intPatientID

,dtmVisit

,intVisitTypeID

,intWithdrawReasonID allow Nulls

TRandomCodes

intRandomCodeID * (1,2,3,4, etc.)

,intRandomCode (1000, 1001, 1002, etc.)

,intStudyID

,strTreatment (A-active or P-placebo)

,blnAvailable (T or F) use a varchar data type

TDrugKits

intDrugKitID * (1,2,3,4, etc.)

intDrugKitNumber (10000, 10001, 10002, etc.)

,intSiteID

,strTreatment (A-active or P-placebo)

,intVisitID (if a Visit ID entered it is already assigned and therefore not available) allow Nulls

TWithdrawReasons

intWithdrawReasonID * (1,2,3,etc.)

,strWithdrawDesc

TGenders

intGenderID* (1,2)

strGender

any help would be greatly apprecaited!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!