Answered step by step
Verified Expert Solution
Question
1 Approved Answer
hi there, please answer questions 5,6,7 and 8. i attached the screenshots of the two SQL files as well. Thank you. ..1 T-Mobile 1:24 AM
hi there, please answer questions 5,6,7 and 8. i attached the screenshots of the two SQL files as well. Thank you.
..1 T-Mobile 1:24 AM 28% 62 .read Build-DB-SaleCo- ver1.sql LINE MIEH CUSTOMER ENCODE LENOVO ONLINE WR LINE UN PODE GS BACODE CUS CUSCODE LEICE GUS SALE UPON OS ME # F.CODE VENDOR P_DISCOUNT OR VAME VRHOME H VOR V STAR DESCRIPTION HOME Submit Assignment Previous Next BED Dashboard Calendar To Do Notifications Inbox 30% Student .ll 1:26 AM AA dn.inst-fs-iad-prod.inscloudgate.net BEGIN TRANSACTION; CREATING TABLE STRUCTURES CREATE TABLE VENDOR ( V CODE INTEGER NOT NULL UNIQUE, V NAME VARCHAR( 35) NOT NULL, V CONTACT VARCHAR(15) NOT NULL, V_AREACODE CHAR(3) NOT NULL, V PHONE CHAR(8) NOT NULL, V STATE CHAR(2) NOT NULL, V_ORDER CHAR(1) NOT NULL, PRIMARY KEY (V_CODE)); CREATE TABLE PRODUCT ( P CODE VARCHAR(10) NOT NULL UNIQUE, P_DESCRIPT VARCHAR(35) NOT NULL, P INDATE DATETIME NOT NULL, P QOH SMALLINT NOT NULL, P MIN SMALLINT NOT NULL, P_PRICE NUMERIC(8,2) NOT NULL, P_DISCOUNT NUMERIC(4,2) NOT NULL, V CODE INTEGER, PRIMARY KEY (P_CODE), FOREIGN KEY (V_CODE) REFERENCES VENDOR (V_CODE)); === CONSTRAINTS, CHECKS and DEFAULTS CREATE TABLE CUSTOMER CUS_CODE INTEGER PRIMARY KEY, CUS LNAME VARCHAR(15) NOT NULL, CUS FNAME VARCHAR(15) NOT NULL, CUS_INITIAL CHAR(1), CUS_AREACODE CHAR(3) DEFAULT '615' NOT NULL, CUS PHONE CHAR(8) NOT NULL, CUS_BALANCE NUMERIC (9,2) DEFAULT 0.00, CONSTRAINT CUS_U11 UNIQUE (CUS_LNAME, CUS_FNAME)); CREATE TABLE INVOICE INV_NUMBER INTEGER PRIMARY KEY, CUS_CODE INTEGER NOT NULL, INV DATE DATETIME NOT NULL Student .il 1:27 AM 30% AA dn.inst-fs-iad-prod.inscloudgate.net www_covu *NADOMAN MUA NUN, INV DATE DATETIME NOT NULL, FOREIGN KEY (CUS_CODE ) REFERENCES CUSTOMER (CUS_CODE)); CREATE TABLE LINE ( INV NUMBER INTEGER NOT NULL, LINE NUMBER NUMERIC(2,0) NOT NULL, P_CODE VARCHAR(10) NOT NULL, LINE_UNITS NUMERIC(9,2) DEFAULT 0.00 NOT NULL, LINE_PRICE NUMERIC (9,2) DEFAULT 0.00 NOT NULL PRIMARY KEY (INV_NUMBER,LINE_NUMBER), FOREIGN KEY (INV_NUMBER) REFERENCES INVOICE (INV_NUMBER) ON DELETE CASCADE, FOREIGN KEY (P_CODE) REFERENCES PRODUCT (P_CODE), CONSTRAINT LINE_U11 UNIQUE (INV_NUMBER, P_CODE)); --======== INDEXES -- Q: Create index on P_INDATE CREATE INDEX P_INDATEX ON PRODUCT (P_INDATE); -- Q: Create composite index on V_CODE and P_CODE CREATE INDEX VENPRODX ON PRODUCT (V_CODE,P_CODE); --======== DATA ENTRY COMMIT; .read LoadRows IntoDBver1.sql --==== LOOK AT TABLES CREATED .print " Below are the tables that were created :" .print " ===== .tables .print " " Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started