SQL/MX Data Mining Guide
Creating the Data Mining Database
HP NonStop SQL/MX Data Mining Guide—523737-001
A-2
,age NUMERIC (3)
DEFAULT NULL
HEADING 'Age'
,number_children NUMERIC (2)
DEFAULT null
HEADING 'Number of Children'
,PRIMARY KEY (account) NOT DROPPABLE
)
LOCATION $P2
PARTITION (ADD FIRST KEY 3000000 LOCATION $VOLUME,
ADD FIRST KEY 5000000 LOCATION $P1);
-- Set constraint on home column; must be Rent or Own or NULL
ALTER TABLE customers
ADD CONSTRAINT home_constraint
CHECK (home = 'Own' OR home = 'Rent' OR home IS NULL);
-- Set constraint on marital status column; must be Divorced,
-- Married, Widow, Single or NULL
ALTER TABLE customers
ADD CONSTRAINT ms_constraint
CHECK (marital_status = 'Divorced' OR
marital_status = 'Married' OR
marital_status = 'Single' OR
marital_status = 'Widow' OR
marital_status IS NULL);
-- Set constraint on gender column; must be F, M or NULL
ALTER TABLE customers
ADD CONSTRAINT gender_constraint
CHECK (gender = 'F' OR gender = 'M' OR gender IS NULL);
-- Create the ACCT_HISTORY table in WHSE schema
DROP TABLE acct_history;
CREATE TABLE acct_history
( account NUMERIC (7) UNSIGNED
NO DEFAULT
NOT NULL NOT DROPPABLE
,year_month DATE