Ask a Question
  
  
  
Top Posters
Since Sunday
136
100
28
15
13
13
13
12
12
12
11
11
New Topic  
wrote...
Posts: 25
Rep: 2 0
A week ago
Explain how relationships are created using SQL. Include an example.
Source  Download Study Guide
Test Bank for Database Processing: Fundamentals, Design, and Implementation
Edition: 15th
Authors:
Read 4 times
3 Replies
Replies
Answer verified by a subject expert
wrote...
Posts: 30
Rep: 9 0
A week ago
Sign in or Sign up in seconds to unlock everything on Biology Forums.
In SQL, relationships are created using a FOREIGN KEY constraint. This has the format:

CONSTRAINT ConstraintNameFK FOREIGN KEY({ForeignKeyColumnInCurrentTable} REFERENCES {ReferencedTableName}(PrimaryKeyColumnInReferencedTable})

The constraint thus names the foreign key column in the current table and its corresponding primary key in a referenced table. As an example, consider an advising relationship from STUDENT to FACULTY. The following constraint might appear in the SQL statement creating the STUDENT table:

CONSTRAINT AdvisorFK FOREIGN KEY (AdvisorID) REFERENCES
FACULTY (FacultyID)
1
Related Topics
wrote...
A week ago
This helped my grade so much
wrote...
A week ago
Perfect
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers.
Learn More
Improve Grades
Help Others
Save Time
Accessible 24/7
  118 People Browsing
Related Images
 1085
 139
 126
Your Opinion
In one word, how would you rate our website?
Votes: 71

Previous poll results: What type of music do you study to?