Perform the following functions using the following commandson the tables created(see tables below)2. Paste SQL and results for each. For the UPDATE command perform Select * and provide screenshot of the results.
Explain in at least 'one' sentence the business problem statement for 'each' of these queries.
Please do not use all these commands on similar tables. You need to diversify so that all your tables get involved in this assignment.
1. UPDATE using WHERE (ampersand (&) in the clause) -
2. SELECT using ROUND function -
3. NON-EQUALITY join of two tables using the JOIN...ON -
4. OUTER JOIN of two tables (LEFT or RIGHT join) -
5. Create a new table (copy of existing table from your project) - then UPDATE one of row of the table and perform MERGE to keep them in sync -
My tables:
CREATE TABLE product_order_tbl (
order_num CHAR(9) NOT NULL,
product_no VARCHAR2(3) NOT NULL,
product_description VARCHAR2(21) NOT NULL,
product_unit_price NUMBER(5,2) NOT NULL,
CONSTRAINT orderproduct_num_CK PRIMARY KEY (order_num, product_no)
);
CREATE TABLE product_info (
product_no VARCHAR2(3) NOT NULL,
product_description VARCHAR2(21) NOT NULL,
CONSTRAINT product_no_pk PRIMARY KEY (product_no)
);
CREATE TABLE customer_tbl (
customer_name VARCHAR2(10) NOT NULL,
billing_address VARCHAR2(14) NOT NULL,
billing_zip CHAR(5) NOT NULL,
billing_city VARCHAR2(8) NOT NULL,
CONSTRAINT customer_name_pk PRIMARY KEY (customer_name)
);
CREATE TABLE order_info (
order_num VARCHAR(9),
order_date DATE NOT NULL,
customer_name VARCHAR2(10) NOT NULL,
order_address VARCHAR2(30) NOT NULL,
order_city VARCHAR2(9) NOT NULL,
order_zip CHAR(5) NOT NULL,
CONSTRAINT order_pk PRIMARY KEY (order_num),
CONSTRAINT customer_name_fk FOREIGN KEY (customer_name) REFERENCES customer_tbl(customer_name)
);
SUBJECT:
MYSQL
Extracted text: 3NF Order_Info Customer_Name (FK) Order_address Order _Num 2312/2019 Order_date Order_city Order_zip 11/2/2019 John Smith 3787 Pineview Dr Cambridge 12210 Customer TBL Billing address 2 Court Square Customer Name Billing_Zip Billing_City John Smith 12210 New York Product Order TBL Product_Info Product No Order _Num 2312/2019 2312/2019 2312/2019 Product_No 001 002 Product_description Product Unit Price Product_description 001 Front and rear cables 100 Front and rear cables 002 New set pedal arms 15 New set pedal arms 003 Labor 3HRS 5 [003 Labor 3HRS