Complete the following queries using the Bookstore database and submit as SQL file. 1. View all
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
SQL Script for Bookstore Database Records This script will drop and then re-create the tables for the Bookstore database. This script was revised from our Part 1 Exercise to include the insertion of records into the tables. Created by: David Vosen Created on: 06/20/2016 Modified on: 06/28/2016 insert records added for each table Modified on: 11/06/2019 better correlation to Bookstore LDM Modified on: 10/20/2021 names and dates to correlate with current students ======= ====== ========= */ -- DROP all tables from previous uses of Bookstore IF OBJECT_ID ('list') IF OBJECT ID ("payment") IF OBJECT ID ('line'). IF OBJECT ID ('invoice") IF OBJECT ID ('product'). IF OBJECT ID ('vendor') IF OBJECT_ID ('customer') -- Create the Customer table CREATE TABLE customer ( cus_code cus_iname cus_fname cus_initial cus_areacode -- cus_phone cus_balance PRIMARY KEY (cus_code)); -- Create the Vendor table CREATE TABLE vendor ( v_code v_name v_contact v_areacode v_phone V_state v_order PRIMARY KEY (v_code)); Create the Product CREATE TABLE product ( P_code v_code p_descript Pindate P_goh P_min P_price p_discount. VARCHAR (10) VARCHAR (50), VARCHAR (50), CHAR(1), CHAR (3), CHAR (7), MONEY table inv_number cus_code VARCHAR (10) VARCHAR (50), VARCHAR(100), CHAR(3), CHAR (7), CHAR (2), CHAR (1) IS NOT NULL IS NOT NULL IS NOT NULL IS NOT NULL IS NOT NULL IS NOT NULL IS NOT NULL VARCHAR (10) VARCHAR(10), VARCHAR (100), DATETIME, INT INT MONEY MONEY, PRIMARY KEY (p_code), FOREIGN KEY (v_code) REFERENCES vendor); -- Create the Invoice table CREATE TABLE invoice ( NOT NULL NOT NULL DEFAULT 0.00, NOT NULL Database if they are stored DROP TABLE list; DROP TABLE payment; DROP TABLE line; DROP TABLE invoice; DROP TABLE product; DROP TABLE vendor; DROP TABLE customer; NOT NULL VARCHAR (10) NOT NULL VARCHAR (10) NOT NULL, DATETIME NOT NULL, NOT NULL, NOT NULL, NOT NULL, inv date PRIMARY KEY (inv_number), FOREIGN KEY (cus_code) REFERENCES customer); UNIQUE, UNIQUE, DEFAULT 'N', UNIQUE, UNIQUE, SQL Script for Bookstore Database Records This script will drop and then re-create the tables for the Bookstore database. This script was revised from our Part 1 Exercise to include the insertion of records into the tables. Created by: David Vosen Created on: 06/20/2016 Modified on: 06/28/2016 insert records added for each table Modified on: 11/06/2019 better correlation to Bookstore LDM Modified on: 10/20/2021 names and dates to correlate with current students ======= ====== ========= */ -- DROP all tables from previous uses of Bookstore IF OBJECT_ID ('list') IF OBJECT ID ("payment") IF OBJECT ID ('line'). IF OBJECT ID ('invoice") IF OBJECT ID ('product'). IF OBJECT ID ('vendor') IF OBJECT_ID ('customer') -- Create the Customer table CREATE TABLE customer ( cus_code cus_iname cus_fname cus_initial cus_areacode -- cus_phone cus_balance PRIMARY KEY (cus_code)); -- Create the Vendor table CREATE TABLE vendor ( v_code v_name v_contact v_areacode v_phone V_state v_order PRIMARY KEY (v_code)); Create the Product CREATE TABLE product ( P_code v_code p_descript Pindate P_goh P_min P_price p_discount. VARCHAR (10) VARCHAR (50), VARCHAR (50), CHAR(1), CHAR (3), CHAR (7), MONEY table inv_number cus_code VARCHAR (10) VARCHAR (50), VARCHAR(100), CHAR(3), CHAR (7), CHAR (2), CHAR (1) IS NOT NULL IS NOT NULL IS NOT NULL IS NOT NULL IS NOT NULL IS NOT NULL IS NOT NULL VARCHAR (10) VARCHAR(10), VARCHAR (100), DATETIME, INT INT MONEY MONEY, PRIMARY KEY (p_code), FOREIGN KEY (v_code) REFERENCES vendor); -- Create the Invoice table CREATE TABLE invoice ( NOT NULL NOT NULL DEFAULT 0.00, NOT NULL Database if they are stored DROP TABLE list; DROP TABLE payment; DROP TABLE line; DROP TABLE invoice; DROP TABLE product; DROP TABLE vendor; DROP TABLE customer; NOT NULL VARCHAR (10) NOT NULL VARCHAR (10) NOT NULL, DATETIME NOT NULL, NOT NULL, NOT NULL, NOT NULL, inv date PRIMARY KEY (inv_number), FOREIGN KEY (cus_code) REFERENCES customer); UNIQUE, UNIQUE, DEFAULT 'N', UNIQUE, UNIQUE,
Expert Answer:
Related Book For
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last
Posted Date:
Students also viewed these databases questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
5) On the graphs below show the difference between a change in price and a change in demand. Fully label graphs for full marks! (2+2 marks) Change in price Change in demand X 6) A change in the price...
-
Consider the following relational schema: Staff ( staffNo , name, dept, skillCode) Skill ( skillCode , description, chargeOutRate) Project ( projectNo ,...
-
In a 1994 study, 164 pregnant, HIV-positive women were randomly assigned to receive the drug AZT during pregnancy and 160 such women were randomly assigned to a control group that received a placebo....
-
Suppose that the production function for a company is given by Q = 80K 1/4 L3/4 where Q is the output (in hundreds of units), K is the capital expenditures (in thousands of dollars), and L is the...
-
The Willow River Mining Company mines and ships coal. It has experienced the following demand for coal during the past eight years: Year Coat Sales (tons) 1 ...........4260 2 ...........4510 3...
-
Explain what is meant by the term qualifying asset in the context of foreign currency transactions. Describe the accounting treatment for exchange differences that relate to qualifying assets.
-
The management of Martinez Manufacturing Company has asked for your assistance in deciding whether to continue manufacturing a part or to buy it from an outside supplier. The part, called Tropica, is...
-
Write the function sum2.m that accepts a matrix m and returns the summation of the positive numbers and the summation of the negative numbers in m. The outputs are sum_p, and sum_n. Use the function...
-
KJJ Corp. was formed on October 10, 2001 by Kimberly Jen (123-45-6789), Jennifer James (234-56\(7890)\) and James \(\operatorname{Kim}(345-67-8901)\). It is a hardware store and is located at 175...
-
Matchpoint is considering producing a low-pressure ball, suited for high altitudes, called the special duty. Each gross of special duty balls would require 1 and man-hours of manufacturing and...
-
a. How do you know you are collaborating well with your group? b. When working with a group, how do you know whether you are effectively giving or receiving constructive criticism? c. Specify five...
-
The movie 21 is about a group of MIT students who "count cards" to improve their probability of winning at Blackjack in casinos. Have you ever wondered what card counting is and if it is legal?
-
Teja was appointed as a trustee involving RM5 million worth of asset including property, shares and general investment. Due to the amount of the trust property, beneficiaries agreed to appoint a...
-
You are a sole practitioner CPA. One of your clients is under audit by the IRS and the Criminal Investigation Division has been involved. The IRS is using an indirect method of establishing...
-
Rhaenyra is a 24-year-old female who is unmarried. She is a South Africa citizen who lives and works in Durban. During the 2022 year of assessment she had earned the following income: R Salary 230...
-
For this analysis, use the variable GOD as your independent variable, comparing individuals who believe in some higher power (3) or know God exists (6). Use the same dependent variables, AGE, EDUC,...
-
Use the information given about the angles and to find the exact value of: (a) sin( + ) (b) cos( + ) (c) sin( - ) (d) tan ( + ) (e) sin(2) (f) cos (2) (g) sin /2 (h) cos/2 cos = 4/5, 0 < < /2; cos =...
-
What are authorization rules?
-
Describe the results of the division process in relational algebra.
-
How do you join tables in an Access query?
-
What are the numbers of observations in each of the five categories that rate the respondents level of job satisfaction?
-
Which of the seven store departments had the most customer visits, and what was this number?
-
How many individuals are in each of the five different credit card categories?
Study smarter with the SolutionInn App