Example of alternative formulation as a table constraint, PL-SQL Programming

Example of Alternative formulation as a table constraint

Example: Alternative formulation as a table constraint

ALTER TABLE EXAM_MARK

ADD CONSTRAINT Must_be_enrolled_to_take_exam_alternative2

CHECK (EXISTS (SELECT StudentId, CourseId

FROM IS_ENROLLED_ON

WHERE StudentId = EXAM_MARK.StudentId

AND CourseId = EXAM_MARK.CourseId)

) ;

In Example, note the use of the table name, EXAM_MARK, as a range variable to qualify references to columns of that table. As always, the condition given as the operand of CHECK is one that would be legal as a WHERE condition following a FROM clause specifying just the table to which the constraint applies (viz., FROM EXAM_MARK in the case at hand).

Posted Date: 1/18/2013 7:43:54 AM | Location : United States







Related Discussions:- Example of alternative formulation as a table constraint, Assignment Help, Ask Question on Example of alternative formulation as a table constraint, Get Answer, Expert's Help, Example of alternative formulation as a table constraint Discussions

Write discussion on Example of alternative formulation as a table constraint
Your posts are moderated
Related Questions
a. Write an anonymous block that contains a PL/SQL function. Given an order number orderNo, the function will calculate the total number of the parts in the order. Then the anonym

Declaring and Initializing Objects: An object type is once defined and installed in the schema; you can use it to declare the objects in any PL/SQL, subprogram, block or packa

Defining Autonomous Transactions To define an autonomous transaction, you use the pragma (compiler directive) AUTONOMOUS_TRANSACTION. The pragma instructs the PL/SQL compiler

COMMIT Statement The COMMIT statement explicitly makes everlasting changes to the database during the present transaction. The Changes made to the database are not considered e

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

Joining in SQL Joining IS_CALLED and IS_ENROLLED_ON in SQL SELECT * FROM IS_CALLED NATURAL JOIN IS_ENROLLED_ON This is an example of an SQL table expression. I have been

what is the use of declare keyword

I need to write one function and one procedure to query a Oracle 10.1 DB using PL SQL. I have the schema and exact queries...along with work Ive started and a template to put the a

Operator Precedence The operations within an expression are completed in a particular order depending on their precedence (priority). The table shows the default order of the op

Exception handling In the PL/SQL, a warning or error condition is known as an exception. The Exceptions can be internally defined (by the run-time system) or user defined. The