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
JOIN and AND in SQL In this Section is all about one operator, JOIN. SQL's closest counterpart, NATURAL JOIN, has already been covered. Here we look at several other "join" op

Parameter and Keyword Description: procedure_name The user-defined procedure is declared by this construct. parameter_name: This identifies the formal parameter t

Declaring Exceptions The Exceptions can be declared only in the declarative part of the PL/SQL subprogram, block, or package. By introducing its name, you can declare an excep

I have a Pascal Source file that needs to be compiled into a Service. In addition, there are various functions (Pascal Procedures I guess) that need to be created to Read and Write

THEO R Y OF SPECIAL CREATION - Life originated on the earth due to natural events by the super natural power. The biblical story of creation of world within six days was p

Using a join on 2 tables, select all columns and 10 rows from the 2 tables without the use of a Cartesian product. Query: SELECT * FROM EMPLOYEE1 E JOIN STAFF S ON E.EMP_

heap sort program in pl/sql

At times, customers make mistakes in submitting their orders and call to cancel the order. Brewbean’s wants to create a trigger that automatically updates the stock level of all pr

Effects of NULL for Multiple Assignments - SQL If the row expression given as the source for a multiple assignment evaluates to NULL, then NULL is assigned to each target. If

Use of COUNT in SQL It describes and discusses various general methods of expressing constraints, eventually noting that support for "=" with relation operands is sufficient f