Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hive create db retail db script #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions retail_db/hive_create_db_retail_db.sql
Original file line number Diff line number Diff line change
@@ -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";