Prev | Current Page 66 | Next

Richard Niemiec

"Oracle Database 10g Performance Tuning Tips & Techniques"

However, this table
contains data for model years before air bags were required, and as a result, this column is either
0 or NULL. One solution, in this case, would be to create a constraint on the AIRBAG_QTY table
to enforce the new rule for new rows added to the table, but not to validate the constraint for
existing rows.
Here is a table created with all constraint types. Each constraint is reviewed in the following
subsections.
create table CUST_ORDER
(Order_Number NUMBER(6) PRIMARY KEY,
Order_Date DATE NOT NULL,
Delivery_Date DATE,
Warehouse_Number NUMBER DEFAULT 12,
Customer_Number NUMBER NOT NULL,
Order_Line_Item_Qty NUMBER CHECK (Order_Line_Item_Qty < 100),
UPS_Tracking_Number VARCHAR2(50) UNIQUE,
foreign key (Customer_Number) references CUSTOMER(Customer_Number));
Null Rule
The NOT NULL constraint prevents NULL values from being entered into the Order_Date or
Customer_Number column. This makes a lot of sense from a business rule point of view: Every
order must have an order date, and an order doesn??™t make any sense unless a customer places it.
Note that a NULL value in a column doesn??™t mean that the value is blank or zero; rather, the
value does not exist. A NULL value is not equal to anything, not even another NULL value. This
concept is important when using SQL queries against columns that may have NULL values.
Unique Column Values
The UNIQUE integrity constraint ensures that a column or group of columns (in a composite
constraint) is unique throughout the table.


Pages:
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
drukarki fiskalne kraków willa karmazyn międzyzdroje www.books61.hobbitstory.com terapia magnetyczna Informacje o hostingu