Source code · SQL

sql/01_schema.sql

25 lines · Part of Credit risk lab · All code · Read only; the files run as published

-- One row per credit card account, in the attribute order of the UCI-- documentation (Yeh and Lien, 2009). Months run from the most recent-- (September 2005) back to April 2005.---- Repayment status codes (UCI): -1 paid duly, 1 to 9 months delayed.-- The data also contains -2 and 0, which the documentation does not define;-- 02_quality.sql counts them rather than guessing. DROP TABLE IF EXISTS accounts; CREATE TABLE accounts (    account_id          INTEGER PRIMARY KEY,    credit_limit        REAL    NOT NULL,   -- NT dollars, individual and family credit    sex                 INTEGER,            -- kept for data checks only, never a model input    education           INTEGER,    marital_status      INTEGER,            -- kept for data checks only, never a model input    age                 INTEGER,            -- kept for data checks only, never a model input    status_sep          INTEGER, status_aug INTEGER, status_jul INTEGER,    status_jun          INTEGER, status_may INTEGER, status_apr INTEGER,    bill_sep            REAL, bill_aug REAL, bill_jul REAL,    bill_jun            REAL, bill_may REAL, bill_apr REAL,    paid_sep            REAL, paid_aug REAL, paid_jul REAL,    paid_jun            REAL, paid_may REAL, paid_apr REAL,    default_next_month  INTEGER NOT NULL CHECK (default_next_month IN (0, 1)));