Example of when or then constraints - sql, PL-SQL Programming

Example of WHEN or THEN Constraints

A concrete example showing how SQL supports WHEN/THEN constraints

CREATE TABLE SAL_HISTORY (EmpNo CHAR (6),

Salary INTEGER NOT NULL,

From DATE

To DATE

PERIOD FOR During (From, To),

PRIMARY KEY (EmpNo, During WITHOUT OVERLAPS)

) ;

The PERIOD FOR specification states that the From and To values in each row denote a time interval (called a period because SQL uses the term "interval" for something else). The From values are treated as closed bounds, the To values as open bounds, so a given row in SAL_HISTORY indicates that an employee was paid a certain salary from the given From date up to but not including the given To date. The specification implies the column constraint NOT NULL NOT DEFERRABLE ENFORCED for each of columns From and To. During WITHOUT OVERLAPS, which, if required, must appear as the last element of the key, specifies that if the same EmpNo value appears in two distinct rows of SAL_HISTORY, then the From and To values in those rows must denote During periods that do not overlap (have no date in common).

Posted Date: 1/18/2013 11:34:42 PM | Location : United States







Related Discussions:- Example of when or then constraints - sql, Assignment Help, Ask Question on Example of when or then constraints - sql, Get Answer, Expert's Help, Example of when or then constraints - sql Discussions

Write discussion on Example of when or then constraints - sql
Your posts are moderated
Related Questions
Entering and Exiting If you enter the executable part of an autonomous routine, the major transaction suspends. When you exit the routine, the major transaction resumes. To ex


LAWS / RULES - Dollo's Law                     :           Living organisms do exhibit evolutionary irreversibility or evolution is irreversible. Williston's Law

Develop Data Business Intelligence Project Project Description: We are linking our Microsoft SQL Database to GoodData Business Intelligence. We are seeking somebody who has e

Relational Algebra - SQL It describes some operators, that together constitute an algebra that is not only relationally complete but also irreducibly so (very nearly- apart f

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

Using LOCK TABLE You use the LOCK TABLE statement to lock the whole database tables in the specified lock mode so that you can share or deny the access to them. For illustrati

Scoping Within the similar scope, all the declared identifiers should be unique. So, even if their datatypes differ, the variables and parameters cannot share the similar name.

SQL Operators The PL/SQL uses all the SQL set, comparison, and row operators in the SQL statements. This part briefly describes some of these operators.  1. Comparison Opera

Using Host Arrays The Client-side programs can use anonymous PL/SQL blocks to bulk-bind input and output host arrays. However, this is the well-organized way to pass the colle