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
Table Literals - SQL One might expect SQL to support table literals in the manner illustrated in Example 2.2, but in fact that is not a legal SQL expression. Example: Not a

BIOCHE M ICA L ORIGIN OF LIFE - It is generally agreed by astronomers, geologists and biologists that the earth is approximately 4500-5000 million years old. It is an

Magento change address format depending on store Project Description: What I need is that depending on the store in which the customer bought the address should change the fo

Create the four tables and populate them with the given data. Answer the following queries in SQL. 1. Get all part-color/part-city combinations. Note: Here and subsequently, the

Due to an increase in overhead costs, the buying price of all items needs to be increased. Management wants to see a report before deciding how much each product will go up. Add to


Use Object Types and Collections The Collection types and object types increase your efficiency by allowing for the realistic data modeling. The Complex real-world entities an

Indeterminacy in SQL Some SQL expressions are actually not function invocations at all in the mathematical sense, being indeterminate-invocations operating on identical input

Use Bulk Binds If SQL statements execute inside a loop using the collection elements as bind variables, context switching between the PL/SQL & SQL engines can slow down the ex

OPEN-FOR Statement The OPEN-FOR statements execute the multi-row query related with a cursor variable. It also allocates the resources used by the Oracle to process the query a