Docsity

Homework Practice Questions - Database Management Systems | MIS 310, Assignments of Introduction to Database Management Systems

Toggle sidebar
bg1
Homework 6 - Answers
For this homework assignment, you will need to hand in both the code and
the results of the code – unless specifically told otherwise in the question.
Both of these items are easily cut and pasted from Access into a Word
document.
1. Create the Vendor Table on page 106 of your book. Please show me the
code you used.
CREATE TABLE VENDOR
(V_CODE CHAR(5) NOT NULL,
V_NAME VARCHAR(15) 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));
2. Create the Product Table on page 106 of your book. Please note that
access does not support the “number (8,2)” convention to specify decimal
places. For these attributes you can just use number. Please show me the
code you used.
CREATE TABLE PRODUCT
(P_CODE VARCHAR(10) NOT NULL ,
P_DESCRIPT VARCHAR(20) NOT NULL,
P_ONHAND NUMBER NOT NULL,
P_PRICE CURRENCY NOT NULL,
P_DISCOUNT NUMBER NOT NULL,
V_CODE CHAR(5),
PRIMARY KEY (P_CODE),
FOREIGN KEY (V_CODE) REFERENCES VENDOR);
3. Insert the values into Vendor Table as shown on page 106. Please show
me the code you used, and a printout of the actual table.
INSERT INTO VENDOR
VALUES(21225, 'Bryson, Inc.', 'Smithson', '615','223-3234', 'TN', 'Y');
INSERT INTO VENDOR
VALUES(21226, 'SuperLoo, Inc.', 'Flushing', '904','215-8995', 'FL', 'N');
INSERT INTO VENDOR
VALUES(21231, 'DE Supply', 'Singh', '615','228-3245', 'TN', 'Y');
INSERT INTO VENDOR
VALUES(21344, 'Gomez Bros.', 'Ortega', '615','889-2546', 'KY', 'N');
pf3
pf4
pf5

Partial preview of the text

Download Homework Practice Questions - Database Management Systems | MIS 310 and more Assignments Introduction to Database Management Systems in PDF only on Docsity!

Homework 6 - Answers

For this homework assignment, you will need to hand in both the code and

the results of the code – unless specifically told otherwise in the question.

Both of these items are easily cut and pasted from Access into a Word

document.

1. Create the Vendor Table on page 106 of your book. Please show me the

code you used.

CREATE TABLE VENDOR

(V_CODE CHAR(5) NOT NULL,

V_NAME VARCHAR(15) 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));

2. Create the Product Table on page 106 of your book. Please note that

access does not support the “number (8,2)” convention to specify decimal

places. For these attributes you can just use number. Please show me the

code you used.

CREATE TABLE PRODUCT

(P_CODE VARCHAR(10) NOT NULL ,

P_DESCRIPT VARCHAR(20) NOT NULL,

P_ONHAND NUMBER NOT NULL,

P_PRICE CURRENCY NOT NULL,

P_DISCOUNT NUMBER NOT NULL,

V_CODE CHAR(5),

PRIMARY KEY (P_CODE),

FOREIGN KEY (V_CODE) REFERENCES VENDOR);

3. Insert the values into Vendor Table as shown on page 106. Please show

me the code you used, and a printout of the actual table.

INSERT INTO VENDOR

VALUES(21225, 'Bryson, Inc.', 'Smithson', '615','223-3234', 'TN', 'Y');

INSERT INTO VENDOR

VALUES(21226, 'SuperLoo, Inc.', 'Flushing', '904','215-8995', 'FL', 'N');

INSERT INTO VENDOR

VALUES(21231, 'DE Supply', 'Singh', '615','228-3245', 'TN', 'Y');

INSERT INTO VENDOR

VALUES(21344, 'Gomez Bros.', 'Ortega', '615','889-2546', 'KY', 'N');

INSERT INTO VENDOR

VALUES(22567, 'Dome Supply', 'Smith', '901','678-1419', 'GA', 'N');

INSERT INTO VENDOR

VALUES(23119, 'Randsets Ltd.', 'Anderson', '901','678-1419', 'GA', 'N');

INSERT INTO VENDOR

VALUES(24004, 'Brackman Bros.', 'Browning', '615','228-1410', 'TN', 'N');

INSERT INTO VENDOR

VALUES(25443, 'BK, Inc.', 'Smith', '904','227-0093', 'FL', 'N');

INSERT INTO VENDOR

VALUES(25501, 'Damal Supplies', 'Smythe', '615','890-3529', 'TN', 'N');

INSERT INTO VENDOR

VALUES(25595, 'Rubicon Sis.', 'Orton', '904','456-0092', 'FL', 'Y');

INSERT INTO VENDOR

VALUES(24288, 'ORDVA, Inc.', 'Hakford', '615','898-1234', 'TN', 'Y');

4. Insert the values into Product Table as shown on page 106. Please

show me the code you used, and a printout of the actual table.

INSERT INTO PRODUCT

VALUES ('11 QER/31', 'Power Painter', 8, 109.99, 0.00, 25595);

INSERT INTO PRODUCT

VALUES (’13- Q2/P2’, ’Saw blade, large’, 32, 14.99, 0.05, 21344);

INSERT INTO PRODUCT

VALUES (’14- Q1/L3’, ’Saw blade, small’, 18, 17.49, 0.00, 21344);

INSERT INTO PRODUCT

VALUES (’1546- QQ2’, ’Cloth Panel, large’, 15, 39.95, 0.00, 23119);

INSERT INTO PRODUCT

VALUES (’1558- QW1’, ’Cloth Panel, medium’, 23, 43.99, 0.00, 23119);

INSERT INTO PRODUCT

VALUES (’2232/QTY’, ’Toolbox, deluxe’, 8, 109.92, 0.05, 24288);

INSERT INTO PRODUCT

VALUES (’2232/QWE’, ’Toolbox', 6, 99.87, 0.05, 24288);

INSERT INTO PRODUCT

VALUES (’2238/QPD’, ’Cordless Drill. ’, 12, 38.95, 0.05, 25595);

INSERT INTO PRODUCT

VALUES (’23109-HB’, ’Claw Hammer ’, 23, 5.95, 0.10, 21225);

INSERT INTO PRODUCT

VALUES (’23114-AA’, ’Sledge hammer ’, 8, 14.40, 0.05,NULL);

INSERT INTO PRODUCT

VALUES (’54778-2T’, ’Rat-tail file, fine’, 43, 4.99, 0.00, 21344);

INSERT INTO PRODUCT

VALUES (’89-WRE-Q’, ’Chain Saw’, 11, 256.99, 0.05,24288);

INSERT INTO PRODUCT

VALUES (’PVC23DRT’, ’PVC Pipe, large ’, 188, 5.87, 0.00,NULL);

INSERT INTO PRODUCT

VALUES (’SM-18277’, ’Metal Screw Set ’, 172, 6.99, 0.00,21225);

p_price p_code $109.92 2232/QTY $99.87 2232/QWE $43.99 1558- QW $39.95 1546- QQ $38.95 2238/QPD $17.49 14- Q1/L $14.99 13- Q2/P $14.40 23114-AA $8.45 SW- $6.99 SM- $5.95 23109-HB $5.87 PVC23DRT

8. Write and execute an SQL command, which will change the discount

to .25 for all the products without a vendor code. Please show me the

query and the results of the query.

update product

set p_discount =.

where v_code is null;

P_CODE P_DESCRIPT P_ONHAND P_PRICE P_DISCOUNT V_CODE

11 QER/31 Power Painter 8 $109.99 0 25595 13- Q2/P2 Saw blade, large 32 $14.99 0.05 21344 14- Q1/L3 Saw blade, small 18 $17.49 0 21344 1546- QQ2 Cloth Panel, large 15 $39.95 0 23119 1558- QW1 Cloth Panel, medium 23 $43.99 0 23119 2232/QTY Toolbox, deluxe 8 $109.92 0.05 24288 2232/QWE Toolbox 6 $99.87 0.05 24288 2238/QPD Cordless Drill 12 $38.95 0.05 25595 23109-HB Claw Hammer 23 $5.95 0.1 21225 23114-AA Sledge hammer 8 $14.40 0. 89-WRE-Q Chain Saw 11 $256.99 0.05 24288 PVC23DRT PVC Pipe, large 188 $5.87 0. SM-18277 Metal Screw Set 172 $6.99 0 21225 SW-23116 Wide Screw Set 237 $8.45 0 21231 WR3/TT3 Steel Matting 18 $119.95 0.1 25595

9. Write and execute a query that will display product codes and product

descriptions of all the products that are produced by vendors from

Tennessee.

select p_code, p_descript

from product, vendor

where v_state = "TN"

and product.v_code = vendor.v_code;

p_code p_descript 2232/QTY Toolbox, deluxe 2232/QWE Toolbox 89-WRE-Q Chain Saw 23109-HB Claw Hammer SM-18277 Metal Screw Set SW-23116 Wide Screw Set