RelationalDBDesign RelationalDBDesign

Select Statement  «Prev 

Query using two Pseudocolumns

', today is ' || SYSDATE
Query using the ROWNUM and SYSDATE pseudocolumns

  1. The ROWNUM pseudocolumn appears here in the SELECT clause just like any column.
  2. The SYSDATE pseudocolumn is concatenated to a literal in the SELECT clause. The SYSDATE pseudocolumn contains the current date and time. Its default display format is the same as other dates.
  3. The ROWNUM values appear here and are incremented for each row.
  4. The SYSDATE values appear here and are the same for each row returned.

The CHECK Constraint

Many columns must have values that are within a certain range or that satisfy certain conditions. With a CHECK constraint, you can specify an expression that must always be true for every row in the table. For example, the RATING table stores the valid ratings; to limit the available values beyond the limits enforced by the column definition, you can use a CHECK constraint, as shown in the following listing:

create table RATING_WITH_CHECK
(Rating VARCHAR2(2) CHECK (Rating <= 9),
RatingDescription VARCHAR2(50));

A column-level CHECK constraint can’t refer to values in other rows; it can’t use the pseudocolumns such as SysDate, User, CurrVal, NextVal, Level, and RowNum. You can use the table constraint form (as opposed to the column constraint form) to refer to multiple columns in a CHECK constraint.