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
Built-In Functions The PL/SQL provides a lot of powerful functions to help you to manipulate the data. These built-in functions fall into the categories as shown below: error r

Data Types in SQL - Decimal DECIMAL, NUMERIC, REAL, FLOAT and various other terms for various sets of rational numbers. When these key words are specified for the declared typ

Named Notation The second procedure call uses the named notation. An arrow (=>) serve as the relationship operator that associates the formal parameter to the left of the arro

Example of Table Literal - SQL Example: A Table Literal (correct version) VALUES ('S1', 'C1', 'Anne'), ('S1', 'C2', 'Anne'), ('S2', 'C1', 'Boris'), ('S3', 'C3'

Expressions   An expression is a randomly complex combination of the constants, variables, literals, operators, & function calls. The simplest expression is the single variabl

THEO R Y OF PANSPERMIA - Arrhenius (1908) postulated the cosmic panspermia theory that claims that organisms existed throughout the universe, and their spores, etc., could

Using Subqueries A subquery is a query (typically enclosed by parentheses) that appears within another SQL data manipulation statement. If evaluated, the subquery gives a va

UTL_FILE: The Package UTL_FILE permits your PL/SQL programs to read & write operating system (OS) text files. It gives a restricted version of the standard OS stream file I/O,

EXCEPTION_INIT Pragma The pragma EXCEPTION_INIT relates an exception name with an Oracle error number. Which allow you to refer to any internal exception by the name and to wri

Operators on Tables and Rows Row Extraction TUPLE FROM r, SQL has row subqueries. These are just like scalar subqueries except that they may specify more than one column.