September 18, 2013 at 9:14 pm
I Have 3 tables....namely Bio, Sex, Status
*Bio
BioID
FirsName
MiddleName
LastName
SexID
StatusID
*Sex
SexID
Sex(Male or Female)
*Status
StatusID
Status(Single, In Relationship or Married)
here is my question...
How can i insert in Table Bio in such a way that the SexID and StatusID would also be insert a data???
September 18, 2013 at 9:30 pm
You Must provide the IDs from each of those tables in your INSERT statement.
INSERT INTO BIO
(
, FirsName
, MiddleName
, LastName
, SexID
, StatusID
)
VALUES
(
'Sammy'
, NULL
, 'Johnson'
, 1
, 1
)
That is what the Foreign Key enforces. That is its job. To not allow any data that is not listed in the List table
Andrew SQLDBA
September 18, 2013 at 10:08 pm
Tnx andrew 🙂
September 18, 2013 at 10:51 pm
hi andrew
what if i will insert in my status table, would the bio table be affected?
:unsure:
September 18, 2013 at 11:21 pm
enriquezreyjoseph (9/18/2013)
hi andrewwhat if i will insert in my status table, would the bio table be affected?
:unsure:
No it will not be affected..
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
September 19, 2013 at 12:33 am
thank you:-)
still have many questions.:unsure:
September 19, 2013 at 11:18 pm
enriquezreyjoseph (9/19/2013)
thank you:-)still have many questions.:unsure:
what questions?
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
September 20, 2013 at 5:44 am
More homework questions, I imagine.
September 20, 2013 at 7:05 pm
hi steve
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply