Explain how relationships are created using SQL. Include an example
What will be an ideal response?
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)
You might also like to view...
The measurement of a township is:
a. 1 mile by 1 mile b. 43,560 square feet c. 36 square miles d. 640 acres
Which of the following statements about the financing of the Social Security program is (are) true?
I. Although the self-employed pay an OASDI tax rate that is twice the employee rate, they are allowed certain deductions that reduce the effective tax rate. II. The earnings base on which OASDI taxes are paid increases annually based on changes in average wages in the national economy. A) I only B) II only C) both I and II D) neither I nor II