Top Posters
Since Sunday
27
26
25
22
21
21
21
20
20
20
19
19
New Topic  
wrote...
Posts: 94
2 months ago
Explain how relationships are created using SQL. Include an example.
Source  Download
Database Processing: Fundamentals, Design, and Implementation
Edition: 15th
Authors:
Read 11 times
3 Replies
Replies
Answer verified by a subject expert
wrote...
Posts: 113
2 months ago
Sign in or Sign up in seconds to unlock everything.
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...
2 months ago
This helped my grade so much
wrote...
2 months 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
  359 People Browsing
 138 Signed Up Today
Your Opinion
Where do you get your textbooks?
Votes: 94

Previous poll results: Do you believe in global warming?
Related Images
 820
 817
 28