Example of foreign key constraint - sql, PL-SQL Programming

Example of Foreign Key Constraint

Example: Alternative formulation for 6.3 as a foreign key constraint

ALTER TABLE EXAM_MARK

ADD CONSTRAINT Must_be_enrolled_to_take_exam_alternative3

FOREIGN KEY (StudentId, CourseId)

REFERENCES IS_ENROLLED_ON;

The formulation in Example is available only because the following conditions hold:

  • There is a one-to-one correspondence from the specified columns, in the specified order, to those of the primary key of IS_ENROLLED_ON. Corresponding columns do not have to have the same name but they must be of the same declared type. The table name for the referenced table (IS_ENROLLED_ON in the example) can be followed by a commalist of column names in parentheses, in which case that commalist-the referenced columns-must correspond exactly, in the correct order, to some key specified for the referenced table. The referenced columns must be explicitly specified when the applicable key is declared using UNIQUE rather than PRIMARY KEY, or when it is declared using WITHOUT OVERLAPS.
  • The referenced table and the referencing table (EXAM_MARK in the example) are both base tables.
Posted Date: 1/18/2013 11:35:54 PM | Location : United States







Related Discussions:- Example of foreign key constraint - sql, Assignment Help, Ask Question on Example of foreign key constraint - sql, Get Answer, Expert's Help, Example of foreign key constraint - sql Discussions

Write discussion on Example of foreign key constraint - sql
Your posts are moderated
Related Questions
SELECT a.child_fname,a.child_lname,concat(b.parent_title,b.parent_fname), b.parent_lname,b.parent_tphone FROM child a,parent b WHERE a.parent_id=b.parent_id ORDER BY a.child_fnam

Perform the following queries on the Hospital1.DB using SQL Anywhere (START EARLY!). a. Which patients have purchased the drug "Tylenol"? List the names and addresses. Arrange the

Synonyms You can create the synonyms to provide location transparency for the remote schema objects like tables, views, sequences, stand-alone subprograms, and packages. Though,

Description: Demonstrate your knowledge of PL/SQL programming by writing and thoroughly testing triggers and stored procedures associated with an e-commerce application that pr

Data Types in SQL - Interval, Boolean INTERVAL for values denoting, not intervals (!) but durations in time, such as 5 years, 3 days, 2 minutes, and so on. BOOLEAN, con

%NOTFOUND The %NOTFOUND is logical, opposite of the %FOUND. The %NOTFOUND yields FALSE if the last fetch returned a row, or TRUE when the final fetch failed to return a row. I


Using a Join on 2 tables, select all columns and all rows from the tables without the use of a Cartesian product. Query: SELECT * FROM EMPLOYEE1 JOIN CONTRACT ON EMPLOYEE

Exceptions An exception is the runtime error or warning condition that can be predefined or user-defined. The Predefined exceptions are raised implicitly through runtime system

Rephrase Conditional Control Statements When computing a logical expression, the PL/SQL uses short-circuit evaluation. That is, the PL/SQL stops evaluating the expression as s