Spaces:
Runtime error
Runtime error
File size: 3,888 Bytes
eb36fa6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | create database retail_banking;
use retail_banking;
create table dim_completeddistrict(
district_id int primary key,
city text,
state_name text,
state_abbrev text,
region text,
division text
);
create table dim_completedacct(
account_id text primary key,
district_id int,
frequency text,
parseddate date,
foreign key(district_id) references dim_completeddistrict(district_id)
);
create table fact_crm_call_center_logs(
date_received date,
complaint_id text,
rand_client text,
phonefinal text,
vru_line text,
call_id int,
priority int,
type text,
outcome text,
server text,
ser_start time,
ser_exit time,
ser_time time,
foreign key(rand_client) references dim_completedclient(client_id)
);
create table dim_completedclient(
client_id text primary key,
sex text,
date_of_birth date,
age int,
social text,
fullname text,
phone text,
email text,
address_1 text,
addres_2 text,
city text,
state text,
zipcode text,
district_id int,
foreign key(district_id) references dim_completeddistrict(district_id)
);
create table dim_completeddisposition(
disp_id text primary key,
client_id text,
account_id text,
type text,
foreign key(client_id) references dim_completedclient(client_id),
foreign key(account_id) references dim_completedacct(account_id)
);
create table dim_completedcard(
card_id text primary key,
disp_id text,
type text,
fulldate date,
foreign key(disp_id) references dim_completeddisposition(disp_id)
);
create table fact_completedloan(
loan_id text primary key,
account_id text,
amount double,
duration int,
payments double,
`status` text,
fulldate date,
location text,
purpose text,
foreign key(account_id) references dim_completedacct(account_id)
);
create table fact_completedtrans(
trans_id text primary key,
account_id text,
type text,
operation text,
amount double,
balance double,
k_symbol text,
bank text,
account text,
fulldatewithtime timestamp,
foreign key(account_id) references dim_completedacct(account_id),
constraint FK_order foreign key(account) references fact_completedorder(account_to)
);
create table fact_completedorder(
order_id int primary key,
account_id text,
bank_to text,
account_to text,
amount double,
k_symbol text,
foreign key(account_id) references dim_completedacct(account_id)
);
create table fact_crm_events(
date_received date,
product text,
sub_product text,
issue text,
sub_issue text,
consumer_complaint_narrative text,
tags text,
is_consumer_consent_provided text,
submitted_via text,
date_sent_to_company text,
company_response_to_consumer text,
is_timely_response text,
is_consumer_disputed text,
complaint_id text,
client_id text,
constraint FK_crm_call foreign key(complaint_id) references fact_crm_call_center_logs(complaint_id),
foreign key(client_id) references dim_completedclient(client_id)
);
create table dim_crm_reviews(
date date,
`stars` int,
reviews text,
product text,
district_id int,
foreign key(district_id) references dim_completeddistrict(district_id)
);
create table dim_luxury_loan_portfolio(
loan_id text primary key,
funded_amount double,
funded_date text,
duration_years int,
duration_months int,
ten_yr_treasury_index_date_funded double,
interest_rate_percent double,
interest_rate double,
payments double,
total_past_payments int,
loan_balance double,
property_value double,
purpose text,
firstname text,
middlename text,
lastname text,
social text,
phone text,
title text,
employment_length int,
building_class_category text,
present_tax_class text,
present_building_class text,
address_1 text,
addres_2 text,
zip_code int,
city text,
state text,
total_units int,
land_square_feet text,
gross_square_feet text,
tax_class_at_time_of_sale int
); |