From 10a72253c9cfebd69102d493620f6b1097b66657 Mon Sep 17 00:00:00 2001 From: Lalo Mouta Date: Mon, 14 Sep 2020 20:12:25 +0200 Subject: [PATCH] hive create db retail db script --- retail_db/hive_create_db_retail_db.sql | 63 ++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 retail_db/hive_create_db_retail_db.sql diff --git a/retail_db/hive_create_db_retail_db.sql b/retail_db/hive_create_db_retail_db.sql new file mode 100644 index 0000000..2e0892d --- /dev/null +++ b/retail_db/hive_create_db_retail_db.sql @@ -0,0 +1,63 @@ +create database retail_db location "/data/retail_db"; + +create external table orders +(order_id Int, +order_date String, +order_customer_id Int, +orderstatus String) +row format delimited +fields terminated by ',' +lines terminated by '\n' +stored as textfile +location "/data/retail_db/orders"; + + +create external table order_items +(order_item_id Int, +order_item_order_id Int, +order_item_product_id Int, +order_item_quantity Int, +order_item_subtotal float, +order_item_product_price float) +row format delimited +fields terminated by ',' +lines terminated by '\n' +stored as textfile +location "/data/retail_db/order_items"; + + +create external table products +(product_id Int, product_category_id Int, product_name String, product_description String, product_price Float, product_image String) +row format delimited +fields terminated by ',' +lines terminated by '\n' +stored as textfile +location "/data/retail_db/products"; + +create external table categories +(category_id Int, category_department_id Int, category_name String) +row format delimited +fields terminated by ',' +lines terminated by '\n' +stored as textfile +location "/data/retail_db/categories"; + +create external table departments +(department_id Int, department_name String) +row format delimited +fields terminated by ',' +lines terminated by '\n' +stored as textfile +location "/data/retail_db/departments"; + +create external table customers +( +customer_id Int, customer_fname String, customer_lname String, customer_email String, customer_password String, customer_street String, customer_city String, customer_state String, customer_zipcode String +) +row format delimited +fields terminated by ',' +lines terminated by '\n' +stored as textfile +location "/data/retail_db/customers"; + +