Top Posters
Since Sunday
31
11
10
9
8
7
7
7
7
6
6
6
New Topic  
wrote...
Posts: 161
4 months ago
Explain how relationships are created using SQL. Include an example.
Source  Download
Database Processing: Fundamentals, Design, and Implementation
Edition: 15th
Authors:
Read 28 times
3 Replies
Replies
Answer verified by a subject expert
wrote...
Posts: 198
4 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...
4 months ago
This helped my grade so much
wrote...
4 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
  139 People Browsing
Your Opinion
What's your favorite coffee beverage?
Votes: 64

Related Images
 682
 220
 42

▶️ Video: Ear Animation

For a complete list of videos, visit our video library