SlideShare a Scribd company logo
1 of 56
/* When debugging the code, use Drop table statements
to drop previously created tables.
When code is re-run, new tables will be created.
This allows easy debugging. */
Drop table dept cascade constraints;
Drop table emp cascade constraints;
Drop table customer cascade constraints;
Drop table product cascade constraints;
Drop table ord cascade constraints;
Drop table item cascade constraints;
Drop table salgrade cascade constraints;
Drop table bonus cascade constraints;
Drop table price cascade constraints;
Drop table dummy cascade constraints;
Purge RecycleBin;
CREATE TABLE DEPT (
DEPTNO NUMBER(2) NOT NULL,
DNAME VARCHAR2(14),
LOC VARCHAR2(13),
CONSTRAINT DEPT_PRIMARY_KEY PRIMARY KEY
(DEPTNO));
INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW
YORK');
INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS');
INSERT INTO DEPT VALUES (30,'SALES','CHICAGO');
INSERT INTO DEPT VALUES
(40,'OPERATIONS','BOSTON');
CREATE TABLE EMP (
EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4) CONSTRAINT EMP_MGR_FK
REFERENCES EMP (EMPNO),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2),
DEPTNO NUMBER(2) NOT NULL,
CONSTRAINT EMP_DEPTNO_FK FOREIGN KEY (DEPTNO)
REFERENCES DEPT (DEPTNO),
CONSTRAINT EMP_EMPNO_PK PRIMARY KEY (EMPNO));
INSERT INTO EMP VALUES
(7839,'KING','PRESIDENT',NULL,TO_DATE('17-NOV-
2011','DD-MON-YYYY'),15000,NULL,10);
INSERT INTO EMP VALUES
(7698,'Blake','MANAGER',7839,TO_DATE('1-MAY-2012','DD-
MON-YYYY'),6850,NULL,30);
INSERT INTO EMP VALUES
(7782,'CLARK','MANAGER',7839,TO_DATE('9-JUN-
2013','DD-MON-YYYY'),5450,NULL,10);
INSERT INTO EMP VALUES
(7566,'Jones','MANAGER',7839,TO_DATE('2-APR-2011','DD-
MON-YYYY'),5975,NULL,20);
INSERT INTO EMP VALUES
(7654,'Martin','SALESMAN',7698,TO_DATE('28-SEP-
2012','DD-MON-YYYY'),4250,27400,30);
INSERT INTO EMP VALUES
(7499,'ALLEN','SALESMAN',7698,TO_DATE('20-FEB-
2013','DD-MON-YYYY'),3600,16300,30);
INSERT INTO EMP VALUES
(7844,'TURNER','SALESMAN',7698,TO_DATE('8-SEP-
2014','DD-MON-YYYY'),3500,0,30);
INSERT INTO EMP VALUES
(7900,'James','CLERK',7698,TO_DATE('3-DEC-2015','DD-
MON-YYYY'),4950,NULL,30);
INSERT INTO EMP VALUES
(7521,'WARD','SALESMAN',7698,TO_DATE('22-FEB-
2016','DD-MON-YYYY'),3250,55500,30);
INSERT INTO EMP VALUES
(7902,'ford','ANALYST',7566,TO_DATE('3-DEC-2016','DD-
MON-YYYY'),6000,NULL,20);
INSERT INTO EMP VALUES
(7369,'SMITH','CLERK',7902,TO_DATE('17-DEC-2015','DD-
MON-YYYY'),3800,NULL,20);
INSERT INTO EMP VALUES
(7788,'SCOTT','ANALYST',7566,TO_DATE('09-DEC-
2014','DD-MON-YYYY'),6000,NULL,20);
INSERT INTO EMP VALUES
(7876,'ADAMS','CLERK',7788,TO_DATE('12-JAN-2013','DD-
MON-YYYY'),4100,NULL,20);
INSERT INTO EMP VALUES
(7934,'MILLER','CLERK',7782,TO_DATE('23-JAN-2016','DD-
MON-YYYY'),4300,NULL,10);
CREATE TABLE BONUS (
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
SAL NUMBER,
COMM NUMBER);
CREATE TABLE SALGRADE (
GRADE NUMBER,
LOSAL NUMBER,
HISAL NUMBER);
INSERT INTO SALGRADE VALUES (1,700,1200);
INSERT INTO SALGRADE VALUES (2,1201,1400);
INSERT INTO SALGRADE VALUES (3,1401,2000);
INSERT INTO SALGRADE VALUES (4,2001,3000);
INSERT INTO SALGRADE VALUES (5,3001,9999);
CREATE TABLE DUMMY (
DUMMY NUMBER );
INSERT INTO DUMMY VALUES (0);
CREATE TABLE CUSTOMER (
CUSTID NUMBER (6) NOT NULL,
NAME VARCHAR2 (45),
ADDRESS VARCHAR2 (40),
CITY VARCHAR2 (30),
STATE VARCHAR2 (2),
ZIP VARCHAR2 (9),
AREA NUMBER (3),
PHONE VARCHAR2 (9),
REPID NUMBER (4) NOT NULL,
CREDITLIMIT NUMBER (9,2),
COMMENTS VARCHAR2 (256),
CONSTRAINT CUSTOMER_CUSTID_PK PRIMARY KEY
(CUSTID),
CONSTRAINT CUSTOMER_CUSTID_CK CHECK (CUSTID >
0));
CREATE TABLE ORD (
ORDID NUMBER (4) NOT NULL,
ORDERDATE DATE,
COMMPLAN VARCHAR2 (1),
CUSTID NUMBER (6) NOT NULL,
SHIPDATE DATE,
TOTAL NUMBER (8,2) CONSTRAINT
ORD_TOTAL_CK CHECK (TOTAL >= 0),
CONSTRAINT ORD_CUSTID_FK FOREIGN KEY (CUSTID)
REFERENCES CUSTOMER (CUSTID),
CONSTRAINT ORD_ORDID_PK PRIMARY KEY (ORDID));
CREATE TABLE ITEM (
ORDID NUMBER (4) NOT NULL,
ITEMID NUMBER (4) NOT NULL,
PRODID NUMBER (6),
ACTUALPRICE NUMBER (8,2),
QTY NUMBER (8),
ITEMTOT NUMBER (8,2),
CONSTRAINT ITEM_ORDID_FK FOREIGN KEY (ORDID)
REFERENCES ORD (ORDID),
CONSTRAINT ITEM_ORDID_ITEMID_PK PRIMARY KEY
(ORDID,ITEMID));
CREATE TABLE PRODUCT (
PRODID NUMBER (6) CONSTRAINT PRODID_PK
PRIMARY KEY,
DESCRIP VARCHAR2 (30));
CREATE TABLE PRICE (
PRODID NUMBER (6) NOT NULL,
STDPRICE NUMBER (8,2),
MINPRICE NUMBER (8,2),
STARTDATE DATE,
ENDDATE DATE);
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('96711', 'CA', '7844', '598-6609',
'JOCKSPORTS',
'100', '5000', 'BELMONT', '415', '345 VIEWRIDGE',
'Very friendly people to work with -- sales rep likes to be
called Mike.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('94061', 'CA', '7521', '368-1223',
'TKB SPORT SHOP',
'101', '10000', 'REDWOOD CITY', '415', '490 BOLI RD.',
'Rep called 5/8 about change in order - contact shipping.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('95133', 'CA', '7654', '644-3341',
'VOLLYRITE',
'102', '7000', 'BURLINGAME', '415', '9722 HAMILTON',
'Company doing heavy promotion beginning 10/89. Prepare for
large orders during
winter.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('97544', 'CA', '7521', '677-9312',
'JUST TENNIS',
'103', '3000', 'BURLINGAME', '415', 'HILLVIEW MALL',
'Contact rep about new line of tennis rackets.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('93301', 'CA', '7499', '996-2323',
'EVERY MOUNTAIN',
'104', '10000', 'CUPERTINO', '408', '574 SUYYYYY RD.',
'Customer with high market share (23%) due to aggressive
advertising.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('91003', 'CA', '7844', '376-9966',
'K + T SPORTS',
'105', '5000', 'SANTA CLARA', '408', '3476 EL PASEO',
'Tends to order large amounts of merchandise at once.
Accounting is considering
raising their credit limit. Usually pays on time.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('94301', 'CA', '7521', '364-9777',
'SHAPE UP',
'106', '6000', 'PALO ALTO', '415', '908 SEQUOIA',
'Support intensive. Orders small amounts (< 800) of
merchandise at a time.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('93301', 'CA', '7499', '967-4398',
'WOMENS SPORTS',
'107', '10000', 'SUNNYVALE', '408', 'VALCO VILLAGE',
'First sporting goods store geared exclusively towards women.
Unusual promotion
al style and very willing to take chances towards new
products!');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE,
NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('55649', 'MN', '7844', '566-9123',
'NORTH WOODS HEALTH AND FITNESS SUPPLY
CENTER',
'108', '8000', 'HIBBING', '612', '98 LONE PINE WAY', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('101.4', TO_DATE('08-JAN-2017','DD-MON-
YYYY'), '610', TO_DATE('07-JAN-2017','DD-MON-YYYY'),
'101', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('45', TO_DATE('11-JAN-2017','DD-MON-YYYY'),
'611', TO_DATE('11-JAN-2017','DD-MON-YYYY'), '102', 'B');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('5860', TO_DATE('20-JAN-2017','DD-MON-
YYYY'), '612', TO_DATE('15-JAN-2017','DD-MON-YYYY'),
'104', 'C');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('2.4', TO_DATE('30-MAY-2016','DD-MON-
YYYY'), '601', TO_DATE('01-MAY-2016','DD-MON-YYYY'),
'106', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('56', TO_DATE('20-JUN-2016','DD-MON-YYYY'),
'602', TO_DATE('05-JUN-2016','DD-MON-YYYY'), '102', 'B');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('698', TO_DATE('30-JUN-2016','DD-MON-YYYY'),
'604', TO_DATE('15-JUN-2016','DD-MON-YYYY'), '106', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('8324',TO_DATE( '30-JUL-2016','DD-MON-
YYYY'), '605', TO_DATE('14-JUL-2016','DD-MON-YYYY'),
'106', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('3.4', TO_DATE('30-JUL-2016','DD-MON-YYYY'),
'606', TO_DATE('14-JUL-2016','DD-MON-YYYY'), '100', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('97.5', TO_DATE('15-AUG-2016','DD-MON-
YYYY'), '609', TO_DATE('01-AUG-2016','DD-MON-YYYY'),
'100', 'B');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('5.6', TO_DATE('18-JUL-2016','DD-MON-YYYY'),
'607', TO_DATE('18-JUL-2016','DD-MON-YYYY'), '104', 'C');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('35.2', TO_DATE('25-JUL-2016','DD-MON-
YYYY'), '608', TO_DATE('25-JUL-2016','DD-MON-YYYY'),
'104', 'C');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('224', TO_DATE('05-JUN-2016','DD-MON-YYYY'),
'603', TO_DATE('05-JUN-2016','DD-MON-YYYY'), '102', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('4450', TO_DATE('12-MAR-2017','DD-MON-
YYYY'), '620', TO_DATE('12-MAR-2017','DD-MON-YYYY'),
'100', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('6400', TO_DATE('01-FEB-2017','DD-MON-
YYYY'), '613', TO_DATE('01-FEB-2017','DD-MON-YYYY'),
'108', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('23940', TO_DATE('05-FEB-2017','DD-MON-
YYYY'), '614', TO_DATE('01-FEB-2017','DD-MON-YYYY'),
'102', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('764', TO_DATE('10-FEB-2017','DD-MON-YYYY'),
'616', TO_DATE('03-FEB-2017','DD-MON-YYYY'), '103', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('1260', TO_DATE('04-FEB-2017','DD-MON-
YYYY'), '619', TO_DATE('22-FEB-2017','DD-MON-YYYY'),
'104', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('46370', TO_DATE('03-MAR-2017','DD-MON-
YYYY'), '617', TO_DATE('05-FEB-2017','DD-MON-YYYY'),
'105', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('710', TO_DATE('06-FEB-2017','DD-MON-YYYY'),
'615', TO_DATE('01-FEB-2017','DD-MON-YYYY'), '107', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('3510.5', TO_DATE('06-MAR-2017','DD-MON-
YYYY'), '618', TO_DATE('15-FEB-2017','DD-MON-YYYY'),
'102', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
ORDERDATE, CUSTID, COMMPLAN)
VALUES ('730', TO_DATE('01-JAN-17','DD-MON-YYYY'),
'621', TO_DATE('15-MAR-2017','DD-MON-YYYY'), '100',
'A');
INSERT INTO ITEM (QTY, PRODID, ORDID, ITEMTOT,
ITEMID, ACTUALPRICE)
VALUES ('1', '100890', '610', '58', '3', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '1', '100861', '611', '45', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '100', '100860', '612', '3000', '1', '30');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '1', '200376', '601', '2.4', '1', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '20', '100870', '602', '56', '1', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '3', '100890', '604', '174', '1', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '2', '100861', '604', '84', '2', '42');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '10', '100860', '604', '440', '3', '44');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '4', '100860', '603', '224', '2', '56');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '1', '100860', '610', '35', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '3', '100870', '610', '8.4', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '200', '200376', '613', '440', '4', '2.2');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '444', '100860', '614', '15540', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '1000', '100870', '614', '2800', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '20', '100861', '612', '810', '2', '40.5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('150', '101863', '612', '1500', '3', '10');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('10', '100860', '620', '350', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('1000', '200376', '620', '2400', '2', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('500', '102130', '620', '1700', '3', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ( '100', '100871', '613', '560', '1', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('200', '101860', '613', '4800', '2', '24');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('150', '200380', '613', '600', '3', '4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '102130', '619', '340', '3', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('50', '100860', '617', '1750', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '100861', '617', '4500', '2', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('1000', '100871', '614', '5600', '3', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('10', '100861', '616', '450', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('50', '100870', '616', '140', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('2', '100890', '616', '116', '3', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('10', '102130', '616', '34', '4', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('10', '200376' , '616', '24', '5', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '200380', '619', '400', '1', '4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '200376', '619', '240', '2', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('4', '100861', '615', '180', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('1', '100871', '607', '5.6', '1', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '100870', '615', '280', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('500', '100870', '617', '1400', '3', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('500', '100871', '617', '2800', '4', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('500', '100890', '617', '29000', '5', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '101860', '617', '2400', '6', '24');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('200', '101863', '617', '2500', '7', '12.5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '102130', '617', '340', '8', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('200', '200376', '617', '480', '9', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('300', '200380', '617', '1200', '10', '4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('5', '100870', '609', '12.5', '2', '2.5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('1', '100890', '609', '50', '3', '50');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('23', '100860', '618', '805', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('50', '100861', '618', '2255.5', '2', '45.11');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('10', '100870', '618', '450', '3', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('10', '100861', '621', '450', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '100870', '621', '280', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('50', '100871', '615', '250', '3', '5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('1', '101860', '608', '24', '1', '24');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('2', '100871', '608', '11.2', '2', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('1', '100861', '609', '35', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('1', '102130', '606', '3.4', '1', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '100861', '605', '4500', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('500', '100870', '605', '1400', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('5', '100890', '605', '290', '3', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('50', '101860', '605', '1200', '4', '24');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '101863', '605', '900', '5', '9');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('10', '102130', '605', '34', '6', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('100', '100871', '612', '550', '4', '5.5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
ITEMID , ACTUALPRICE)
VALUES ('50', '100871', '619', '280', '4', '5.6');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('4.8', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'100871', '3.2', TO_DATE('01-DEC-2016','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('54', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'100890', '40.5', TO_DATE('31-JUL-2016','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('58', TO_DATE('01-AUG-2016','DD-MON-YYYY'),
'100890', '46.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('30', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'100860', '24', TO_DATE('31-DEC-2016','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('32', TO_DATE('01-JAN-2017','DD-MON-YYYY'),
'100860', '25.6', TO_DATE('31-MAY-2017','DD-MON-
YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('35', TO_DATE('01-JUN-2017','DD-MON-YYYY'),
'100860', '28', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('39', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'100861', '31.2', TO_DATE('31-DEC-2016','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('42', TO_DATE('01-JAN-2017','DD-MON-YYYY'),
'100861', '33.6', TO_DATE('31-MAY-2017','DD-MON-
YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('45', TO_DATE('01-JUN-2017','DD-MON-YYYY'),
'100861', '36', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('2.4', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'100870', '1.9', TO_DATE('01-DEC-2016','DD-MON-YYYY'));
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('2.8', TO_DATE('01-JAN-2017','DD-MON-YYYY'),
'100870', '2.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('5.6', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'100871', '4.8', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('24', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'101860', '18', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('12.5', TO_DATE('01-JAN-2016','DD-MON-
YYYY'), '101863', '9.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('3.4',TO_DATE( '01-JAN-2016','DD-MON-YYYY'),
'102130', '2.8', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('2.4', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'200376', '1.75', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID,
MINPRICE, ENDDATE)
VALUES ('4', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
'200380', '3.2', '');
CREATE INDEX PRICE_INDEX ON PRICE(PRODID,
STARTDATE);
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100860', 'ACE TENNIS RACKET I');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100861', 'ACE TENNIS RACKET II');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100870', 'ACE TENNIS BALLS-3 PACK');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100871', 'ACE TENNIS BALLS-6 PACK');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100890', 'ACE TENNIS NET');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('101860', 'SP TENNIS RACKET');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('101863', 'SP JUNIOR RACKET');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('102130', 'RH: "GUIDE TO TENNIS"');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('200376', 'SB ENERGY BAR-6 PACK');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('200380', 'SB VITA SNACK-6 PACK');
commit;
set feedback off
cl screen
set heading off
/* Drop Table statements are used during the code debugging
stage.
Once code is correct, they are no longer needed.
However, one can keep the statements for re-creating the initial
tables
later.*/
drop table TranDetail cascade constraints;
drop table Book cascade constraints;
drop table Tran cascade constraints;
drop table BookType cascade constraints;
drop table Student cascade constraints;
purge recyclebin;
Create table TranDetail
(TranID number(4),
Bcode varchar2(5),
ReturnDate Date);
insert into TranDetail values (1,'3330', to_date('3/5/2015
14:15:31','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (1,'9440', to_date('3/6/2015
11:00:21','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (2,'2220', to_date('3/8/2015
12:05:35','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (2,'2510', to_date('3/9/2015
13:32:45','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (3,'2740', to_date('3/9/2016
9:06:07','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (4,'3330', to_date('3/8/2016
8:30:46','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (4,'9440', to_date('3/8/2016
9:40:23','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (5,'1510', to_date('4/5/2016
15:09:45','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (5,'2220', to_date('4/6/2016
19:34:56','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (5,'2510', to_date('4/7/2016
8:56:12','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (6,'2510', to_date('5/6/2016
16:15:34','dd/mm/yyyy hh24:mi:ss'));
insert into TranDetail values (7,'2740', to_date('5/5/2016
11:04:09','dd/mm/yyyy hh24:mi:ss'));
Create table Book
(Bookcode varchar2(5) primary key,
Title varchar2(35),
Type varchar2(20));
insert into Book values ('1510','True confessions','Mistery');
insert into Book values ('2220','The big','Drama');
insert into Book values ('2510','The little mermaid','Children');
insert into Book values ('2740','Backdraft','Action');
insert into Book values ('3330','Steve Jobs','Biograph');
insert into Book values ('9440','Other world','Science Fiction');
Create table Tran
(TranID number(4) primary key,
StudentId varchar2(10),
TranDateAndTime date);
insert into Tran values (1,'1002', to_date('3/4/2015
9:45:15','dd/mm/yyyy hh24:mi:ss'));
insert into Tran values (2,'1003', to_date('3/5/2015
15:00:23','dd/mm/yyyy hh24:mi:ss'));
insert into Tran values (3,'1003', to_date('3/6/2016
14:00:45','dd/mm/yyyy hh24:mi:ss'));
insert into Tran values (4,'1004', to_date('3/7/2016
8:45:34','dd/mm/yyyy hh24:mi:ss'));
insert into Tran values (5,'1005', to_date('4/2/2016
9:00:21','dd/mm/yyyy hh24:mi:ss'));
insert into Tran values (6,'1001', to_date('5/2/2016
16:15:44','dd/mm/yyyy hh24:mi:ss'));
insert into Tran values (7,'1003', to_date('5/4/2016
15:00:51','dd/mm/yyyy hh24:mi:ss'));
create table Booktype
(typename varchar2(25) primary key,
avgscore number(4,2));
insert into Booktype values('Action',3.00);
insert into Booktype values('Biography',2.50);
insert into Booktype values('Children',4.00);
insert into Booktype values('Drama',3.50);
insert into Booktype values('Mistery',3.50);
insert into Booktype values('Science Fiction',3.50);
Create table Student
(StudentId varchar2(10) primary key,
Fname varchar2(20),
LName varchar2(25),
address varchar2(25),
city varchar2(15),
State char(2),
Zip varchar2(5),
Phone varchar2(12),
RegDate Date);
insert into Student values ('1001','Jerry','Seidmann','10 East
Ave','Englewood','CO','80111','303-429-2778',to_date('30-3-
2002','dd-mm-yyyy'));
insert into Student values ('1002','Mary','Taylor','37 South
Ave','Centennial','CO','80112','303-429-8990',to_date('2-4-
2004','dd-mm-yyyy'));
insert into Student values ('1003','Hugh','Ryan','68 Main
St.','Denver','CO','80202','429-742-7243',to_date('1-5-1994','dd-
mm-yyyy'));
insert into Student values ('1004','Robert','Russell','98 Lakeside
Dr.','Denver','CO','80217','720-643-7889',to_date('4-8-2014','dd-
mm-yyyy'));
insert into Student values ('1005','David','Stafford','80 River
Rd.','Bloomfield','CO','80020','303-447-1435',to_date('5-8-
2012','dd-mm-yyyy'));
set feedback on
commit;
set heading on
Students may form groups of 1-3 students for the project. One
page project proposal requirements
Please see the following four pages concerning where to find a
project, what projects are unsuitable, and the originality
requirements of the project.
For the one-page proposal on the project chosen, briefly address
these points:
· Describe background of the company;
· Describe relevant daily business operations and information
needed for or generated from those daily business operations.
These daily business operations require information as inputs
and/or generate information as outputs so it would benefit from
having relevant input and output information stored in a
database. For example, if the project chosen is for a store, the
daily operation is customer’s making purchases. You would say
something like this:
“Customers come to the store to select products they want to
buy. When they check out, the system (the store) calculates the
total due (relevant daily business operations). After the
customer pays for the purchase, the store gives the customer a
receipt. These daily business operations require price
information for each product and quantity information for each
product purchased by the customer (Inputs) in order to calculate
the total due. After the transaction is completed, the system
(store) stores that this transaction has taken placed, with details
about what were bought, how many, and at what prices
(outputs).”
· Problems with the current way of information (data)
management
· Proposed way of data management (i.e., what data to store in
the database and what functionalities to provide in the interface)
· What is your project source? (See Pages 2-3)
· How and from whom would you obtain data requirements for
the database?
· Who would be the intended users of your database?
· If possible for your project source, provide sample data
(modify any confidential data to preserve confidentiality. In
fact, actual data are NOT needed, only fictitious data that look
like the actual data are needed.) If sample data come on hard
copies of filled-out forms, blank forms filled with fictitious data
that look like the real data are sufficient.
You won’t be receiving a grade for this one-page project
proposal. The purpose of the report is to communicate your
topic selection to me so I can help you decide whether or not
the project is appropriate. Hand in your hard-copy project
proposal in class on or before the due date listed in Canvas and
in the Syllabus. Electronic submissions to Canvas are also
accepted.
Avoid unsuitable projects (See Page 4). You may change your
project idea later if you later find a better project idea. Please
provide another one-page project proposal as described above if
that happens.
Submitting this concept of a database for approval indicates that
you claim the originality of this project (See Pages 4-5).
In the next stage of the project, you’ll need to collect detailed
information about what data are needed for those businesses
operations, what data are generated that need to be stored in the
database, and how data relate to each other, that is, business
rules concerning the data. When designing the ERD, having
sample data will help you understand the data better. However,
when eventually submitting your database for grading, fictitious
data are sufficient.Size of the project
The ideal size of the project is 5-7 tables.Database Project
Sources
Decide on an application for which you’ll design the database.
Choose a project where the main purpose is to store and retrieve
operational data. The preferred project is one intended for some
real user(s) (including family and friends). A database intended
for your own use is ok. A made up database with imagined users
is not recommended though acceptable. Here I discuss four
sources of database projects (Pages 2-3). Unsuitable projects are
discussed on Page 4.Project Source 1: Organic
The most organic source of a database project is through your
network of friends, family members, acquaintances, or your own
work place. Many solo or other types of small businesses do not
already have a database for their day-to-day business
operations. Even some medium or large sized companies may
need a small database for non-mission-critical things like
employee training, various task forces, internal “instance”
reports and such, even though they usually have databases for
their core day-to-day business operations.
Here are some organically sourced project examples done by
students in the past:
· A database for a bed-and-breakfast place owned by a student’s
parents. The database keeps track of reservations, checking in,
checking out, and pricing.
· A database for a tree farm owned by a student’s parents that
stores information about various trees grown on the farm,
customer orders, and tree deliveries.
· A database for a daycare center operated by a student’s spouse
that stores information about the children, check-in and check-
out times on each day for each child, and their account balances
and payment information.
· A database that stores prospective real estate clients,
viewings, and mailings information for a student’s friend.
· A database that stores information about employee training,
courses they took, and certifications information for a student’s
workplace.
· A database that stores information about various small medical
devices that patients can rent out for a student’s workplace.
· A database that keeps track of various computing devices of
employees, licenses of applications, connections to various
servers etc. for a student’s workplaceProject Source 2: Reverse
engineering a database
If you really can’t find an organic project, before deciding on a
made-up project, try reverse engineering. Reverse engineering
is to design a database based on your interactions with an
existing database on the desktop or on the Web. For example, if
you work as a human resources specialist at a company and use
a human resources management software, you can design a
database based on your knowledge of the type of information
stored in the human resources database and the type of
interactions it affords the user. If you work or worked at a store
that sells and resells computer games and have used the sales
database, you can design a database based on your knowledge
and interactions with that database. You may also interact with
databases on the web (example, Amazon.com’s vast database).
You can design the database (a part of it) based on your
interactions with the ecommerce site.
Do Review Page 4 for originality requirements for reverse
reengineering.Project Source 3: Preferred way of making up a
database
If you still can’t find an organic project and can’t find a
database to reverse engineer, the preferred way of making up a
database project is to base your database on a real business that
you’re familiar with. As mentioned before, medium sized or
large companies usually already have databases to support their
day-to-day core business operations. If you work or worked for
a company and are familiar with the core business, you may
make up a database that would support the daily operations of
that company or that would support some other business
operations that you’re familiar with.Project Source 4: Desperate
way of making up a project
If no one in your network seems in need of a database, you have
not interacted with a database that could offer reverse
engineering, you have not worked for any company that used a
database, and you have not worked in a company that can give
you inspirations for a database idea, and you don’t know anyone
who may be able to help you get a project idea, in short, if you
are desperate, then imagine an organization or a business and
imagine how that organization or business work and proceed to
design your database. If you decide to proceed with a made-up
database, your database needs to be substantially different from
any of the examples or homework problems that I have written
up. Also talk to me first before choosing this route.
Unsuitable Projects
1. 1-3 tables: If a database project will end up having only 1-3
tables, it is not suitable because such a project, though maybe
valuable, does not offer you the opportunity to practice ERD or
table design. Examples are NFL team stats database (one table),
catalog of books (book table and category table-2 tables),
customer complaints database (complaints table --1 table). An
ideal project should have about 5-7 tables –complex enough to
offer ERD and table design practices and small enough to do as
a class project.
2. Database problems involving other main tasks such as
synchronizing data from multiple databases, integrating one
database into another, automatic uploading of data from an
outside source etc. are interesting and practical database
problems in general. However, they are not the topics of this
course and therefore are not suitable for the class project.
3. If two teams’ projects are too similar to each other’s, they are
not suitable.Originality Requirement
No matter what your source is for the database, it must satisfy
the originality requirement as discussed below.
Each student or team is required to collect and compile their
own information requirements, design the ERD, design the
tables, and implement the database in ACCESS and Oracle. A
project where information requirements are laid out already in
writing or where the ERD is already given, or where the tables
are already designed is not acceptable. When you submit a
project idea for me to approve, the assumption is that the
information requirements do not already exist in a document
written by someone else (changing a few things here and there
is not considered sufficiently different). If this is not the case,
you’re required to disclose that information to me, before the
project is approved.
Sometimes a student may have already done (or is doing)
an original project for a different course. If the project idea is
original to the student, the student may use that same idea in
this course with some penalty points. This is because the
student is using the same work to receive credits in two
different courses. If the database in the other course is not the
original work of the student, for example, when the instructor of
that course gives the information requirements and the ERD,
that database can’t be used as the class project.
Reverse engineering: If a student intends to design the database
based on his/her interactions with a user interface, it is
acceptable if 1) the student discloses that reverse engineering is
used based on the available (often web-based) interface, 2)
there is no written document of information requirements
available to the student, and 3) there is no corresponding ERD
or table design available to the student. Situations where these
conditions are not satisfied are unacceptable project situations.
Borrowed ideas: If a student finds project ideas from a written
source, the project is acceptable if 1) the student discloses that
the idea is borrowed from a written source and submits the
written source with the project submission, 2) the student
compiles information requirements using his/her own language
and the resulting document is substantially smaller (at least a
third smaller in number of words), and 3) there is no
corresponding ERD or table design available to the student.
Situations where these conditions are not satisfied are
unacceptable project situations.
Other limitations: Other situations not discussed here may or
may not be acceptable. When attempting a project in non-
standard situations (the standard situation is one where all
elements are original and the student is starting from ground
zero), it is the student’s responsibility to disclose all
information known to the student concerning what’s already
been done or will be done by others by the project due date
about a particular application environment.
5 | Page
Prj3: Project Final Requirements25 Points. Submit all
documents to Canvas.Deliverables
1. An ACCESS database file containing all your tables and the
interface. (Steps 1 & 3)
2. A Word file containing Steps 2 & 4.
3. If relevant, supporting documents for Step 4.Submission of
project
Submit all documents through Canvas in one group member’s
Canvas account. Make sure you have attached all files before
hitting the submit button. Note that multiple files can be
attached, one-by-one, through the submission area.
Step 1 (0 Points). If you didn’t create all tables in ACCESS in
Prj3, implement all tables in ACCESS in this stage. Enter some
data in each table. Define the PKs and the FKs. You may use
fictitious data. For tables like Customer, Emp, and Product,
enter 5 or more rows of data; for tables like Order, Purchase,
Transaction, Class, enter 7 or more rows of data; For tables like
TransactionDetails; OrderDetails (i.e., tables created from m-n
relationships), enter 12 or more rows of data. (If you have
already done this for Prj3 and submitted it for grading, there is
nothing to do for Step 1.)
Step 2: (5 Points): Describe the functionalities that users of this
database would like implemented. This is the basis for your
interface design. This is where you discuss functionalities from
the user's perspective, before the interface is designed. This is
not where you discuss the forms in your database. Note that all
tables in your database must be used in some fashion; otherwise
you’ll lose points in the Interface Design step (Step 3). Submit
this in a Word document with a cover page that lists 1) name of
project, course number and title, semester and year, 2) group
member names.
Step 3: (20 Points) Interface Design
Design the ACCESS interface on top of the tables your created
in Step 1 to allow users to interact with them
(retrieve/insert/delete/update). Your interface should provide
functionalities described in Step 2. Since a database allows
users to retrieve, update, delete, and insert data, you may want
to design your interface to provide users with easy or
background retrieval/updating/deleting/inserting. For example,
you may want to design some parameter queries to retrieve
information. You may also allow users to perform searches. For
another example, if you are designing a database for a library,
the switchboard should contain a textbox or a combo box for
entering a PatronId for checking out books. Upon entering the
PatronId, a new row is automatically added to Table
"Transaction." This new row records current date/time and
PatronId. Next, there should be a textbox or combo box to
entering barcode of each book checked out. Upon checking out
each book, a new row is automatically added to Table
"TransactionDetails" for each barcode so entered so which
books the patron is taking out are recorded. Table "Book"
should be updated to record that these books are checked out.
Users should be able to navigate from one form to another in a
logical, easy-to-use fashion. To achieve that, use various
controls discussed in class such as combo boxes and command
buttons. Subforms are also a very good way to allow users
access multiple inter-connected tables in the database. Use
Macros to automate automating routine business operations such
as updating book status upon checking out as discussed above.
Just build a form for each table, which would allow users to
insert, delete, and update rows, would not earn you a good
grade for this step. Your design of the interface should validate
your data requirements stated in Prj1 (if users cannot interact
with certain data, why store them?), and should correspond to
required functionalities addressed in Step 2.
Note: Try to use all principles discussed in the handout: e.g., 1).
user combo boxes for foreign keys and other places, 2) use auto
look up forms, 3) use subforms, 4), use unbound controls to
solicit input for searches, 5) provide ADD, DELETE, SAVE,
and CLOSE buttons, 6) Use Update, Insert, and Delete queries
that are called by macros, 7) Use macros for automation.
Step 4: State project source (see Prj0 one-page description
requirements document) and Provide Supporting Documents, if
applicable
If your project is a real-world project, say so and provide
supporting documents. Attach blank paper forms for the
application environment that you are designing the database for.
In your write-up, provide the actual mailing or web address of
the company. You may provide other contact info as well (such
as phone numbers) and any information that may substantiate
your claim that it is a real-world project. If no claim is made or
no supporting documents are provided, your project will be
considered a made-up project. (Note, paper forms are forms
people fill out using a pen, not ACCESS forms.) If you’re
reverse engineering a database, say so and provide web links
and supporting documents if possible.Grading of the project:
The total project score is adjusted up for complex projects and
for real-world projects.
Late Project Policy
Late project carries a penalty of 0.5 point (out of 100) every 2
hours. 2 Points maximum every 24 hours. Late projects start
counting at 8:00 am the next day. (This is to say, even though
the project is due at 11:59 pm the previous day, as long as you
submit it by 8:00 am the next day, there is no penalty.) Late
projects submitted on or after the date that grades are due from
the instructor to the Registrar’s office is considered “Missed
Projects.” This date is usually the Wednesday after the final’s
week. Missed projects will receive 0. Exceptions may be made
concerning missed projects if special situations arise. Consult
the instructor as soon as possible if such situations arise.
Please note that if you wait until the last couple of days to work
on your project and something comes up (e.g., you get sick or
you experience a traumatic event) causing you to miss the
deadline, penalty will still be imposed. To give yourself enough
time, you may want to start this stage ASAP.
2 | Page
Project Stage 2: Oracle Implementation25 Points. Submit all
documents to Canvas.Size of Database
The ideal size of the project is about 5-7 tables. This offers
enough complexity and is also manageable. More than seven
tables may be too large. Oracle Account to Use and Clean Up
1. Each student has another account with the userid ORA##PRJ.
The initial password is dbclass. (So you log in using ORA##PRJ
as userid and dbclass as password. ## is the two digits assigned
to you.)
2. You must use ORA##PRJ for this part of the project
(otherwise you’ll lose points).
3. Clean up your ORA##PRJ account first by removing all
tables irrelevant to your project. By the time I grade your
project, your ORA##PRJ must contain only tables relevant to
your project (otherwise you’ll lose points).
Be sure to change your password otherwise someone else may
accidentally log in to your account, remove all your tables, and
put his/her tables in your account. You would lose a lot of
points if that happens to you.
PRJ2 Steps
Step 1) (5 Points). Implement all tables in ACCESS. Enter some
data in each table. Define the PKs and the FKs. You may use
fictitious data. For tables like Customer, Emp, and Product,
enter 5 or more rows of data; for tables like Order, Purchase,
Transaction, Class, enter 7 or more rows of data; For tables like
TransactionDetails, OrderDetails (i.e., tables created from m-n
relationships), enter 12 or more rows of data.
Step 2: (20 Points): Oracle SQL
a). Drop all tables in your project account (ORA##PRJ) that are
irrelevant to your project. Each group member must do this and
is evaluated separately for a)..
b). Choose 6 tables connected through PK-FK pairs (no islands)
AND create those tables in each group member’s ORA##PRJ
account. In a script file, create the tables, define all primary
keys and foreign keys, and insert the same data that you entered
in ACCESS. If a table has many rows of data, inserting up to 12
rows of data is sufficient. See cretabs.sql posted in Oracle
module for example. (For example, the tables that we have been
working with: Product—Item—Ord—Customer—Emp—Dept are
6 tables that are connected by PK-FK pairs as indicated by “—“.
If you have 6 or fewer tables, create all your tables in Oracle.)
Note, I ask you to create the tables in ACCESS first so you only
need to type the actual data once. After entering the data in
ACCESS, from ACCESS, you can use the “Export” function to
export the data in each table to a text file. Then you can
combine the text files and modify the combined text file to
create the script file for Oracle.
c). At the beginning of the script, add some comments (use /*
*/ or use --) to provide a “Cover Page.” The comments area
should contain i) name of project, course number and title,
semester and year, ii) all group member names, and iii) Oracle
account Ids for all group members. I need your account user
names but not your passwords to grade your project.
d). Each group member should run the script in his/her own
ORA##PRJ account and generate the same project tables. If
your account does not contain your project tables, you’ll lose 12
points for Step 2. Group members are graded separately for d).
You’ll lose points if 1) you did not indicate on your cover page
your oracle account(s) used for your project, or 2) your ora##prj
account has irrelevant tables.
Deliverables
1. An ACCESS file containing all your tables, with the primary
keys and foreign keys defined and data inserted.
2. ONE script file creating 6 of your tables, related keys, and
data, with a comments area at the beginning that serves as a the
“Cover Page.” Do not put the “Cover Page” on a separate file.
3. The 6 Tables with data and related keys created in your
Oracle project accounts (ORA##PRJ). This is the result of Step
2. I'll check them in your Oracle project accounts using my own
script. There is nothing to actually submit for this deliverable
item. Run the script in each group member’ account to create
the tables, define constraints, and insert data.Submission of
project
Submit both documents (ACCESS file and Script file) through
Canvas in one group member’s Canvas account. Make sure you
have attached both files before hitting the submit button. Note
that multiple files can be attached, one-by-one, BEFORE
clicking on the Submit button.
Do not make two submissions each with a different file. When I
download students’ submissions for grading, only files in the
last submission will be downloaded. So if you have to make
another submission before the deadline, attach both files again.
Do not make submissions from two or more group members’
Canvas accounts. Submit both files from one group member’s
Canvas account only.
2 | Page
Project Requirements Stage 2 15 Points
Step 1) (0 Points) Include your ERD with this submission. Stage
2 can’t be graded if your ERD is not included. Modify your
ERD according to feedbacks given. If you have modified your
ERD, submit the modified ERD.
Step 2) (15 Points) Transform the E-R model into a relational
data model. Report the following 6 steps. Follow the example
seen here.
a) Convert every entity into a table. Use underline(s) to identify
the primary key of a table. See Example a) on the next page.
b) Convert all 1-n and 1-1 relationships. Clearly indicate
attributes added as a result of converting a 1-1 or a 1-n
relationships. Use italic fonts for this purpose. See Example b)
on the next page.
c) Convert all m-n relationships. See Example b) on the next
Page.
d) List the final conversion result. See Example c) on the next
page. Use underlines to indicate primary keys. Identify foreign
keys in each table.
e) After you have listed the tables based on the ERD, determine
which normal form each table is in. If a table does not satisfy
BCNF, either normalize it or clearly state the reasons why you
choose to keep the table in a lower normal form. See Example
d) on the next page.
f) List the final normalized tables with primary keys and foreign
keys identified. See Example e) on the next page.Example:
Project ERD and the conversion process are shown on the next
pages.
a): Convert all entities and get:
Vendor: (vendorId, vname, address, phone)
Order: (order#, Orderdate)
Product: (Stock#, price, Desc)
Payment: (PaymentNo, Pdate, Amount)
b): Convert all relationships
· Vendor-places-Order Relationship: This is a 1-n relationship
with an attribute. Add the primary key of "1" entity (Vendor) to
the many side (Order) as a foreign key. Relationship attribute is
added too. Get:
Order: (order#, Orderdate, VendorId, OrderSource)
Foreign key: VendorId
· Order-Contains-Products Relationship: This is anm-n
relationship with attributes, so make a new table, OrderDetails:
OrderDetails: (Order#, Stock#, Quantity, Price)
Foreign keys: Order#, Stock#
· Payment-pays for-Order: This is a 1-1 relationship. Since each
payment must have a corresponding order but each order may
not have a corresponding payment yet, to advoid null values,
add order# (“1” side) to Payment (pretend “many” side). Get:
Payment: (PaymentNo, PDate, Amount, Order#)
Foreign key: Order#
c): Final Conversion Result:
Vendor: (vendorId, vname, address, phone)
Order: (order#, Orderdate, VendorId, OrderSource) Foreign key:
VendorId
Product: (Stock#, price, Desc)
Payment: (PaymentNo, Pdate, Amount, Order#). Foreign key:
Order#
OrderDetails: (Order#, Stock#, Quantity, Price). Foreign keys:
Order#, Stock#
d): Normal Form Determinations:
All Tables are in BCNF.
e): Final Result after normalization
Vendor: (vendorId, vname, address, phone)
Order: (order#, Orderdate, VendorId, OrderSource) Foreign key:
VendorId
Product: (Stock#, price, Desc)
Payment: (PaymentNo, PDate, Amount, Order#). Foreign key:
Order#
OrderDetails: (Order#, Stock#, Quantity, Price). Foreign keys:
Order#, Stock#
3 | Page
PaymentPaymentNoPDateOderOrder#OrdateVendorvnameaddre
ssVendoridphoneProductStock#PricePaysForContainsPlaces1nm
11nDescSourceQuantityPriceAmount
Payment
PaymentNo
PDate
Oder
Order#
Ordate
Vendor
vname
address
Vendorid
phone
Product
Stock#
Price
PaysFor
M1
M2
M3
M4
M1
M2
M3
M4
Contains
Places
M1
M2
M3
M4
M1
M2
M3
M4
M1
M2
M3
M4
M1
M2
M3
M4
1
n
m
1
1
n
Desc
Source
Quantity
Price
Amount
Stage 1 Project Requirements –Data Requirements and ERD
35 Total Points. Submit a hard copy before class.
Step 1): (15 Points) Discuss information requirements for the
database application, addressing the following points.
· (0.5 point) Discuss background of the company and the
industry they are in.
· (0.5 point) Discuss problems with the current way of doing
business or with the current system, problems with obtaining
timely and accurate vital information. Your database may not be
able to resolve all problems identified here. Specify the
problems your database is trying to solve (i.e.; scope of your
solution).
· (4 points) Provide detailed descriptions of business operations
that will need or generate data for which you are designing the
database. The write up here serves as the natural language
description of data requirements. This is not the place to
describe your tables or what the attributes are for the tables.
This is where you describe business processes and business
rules.
· (8 Points) Use the four sentence templates discussed in class
to describe detailed data requirements that mostly match the
data requirements descriptions in the last bullet. The sentences
should start with “Database needs to store.” For cardinality of
each relationship, start the two sentences with “each.” See the
third sub-bullet below. The descriptions of data requirements
should be such that another person (say, your instructor) can
draw an ERD based on your descriptions. You may want to use
bulleted statements to clearly state data requirements. Provide
an example instance of each entity as well as for attributes of
relationships. Here are some examples:
· (For entities, attributes, and primary keys). Database needs to
store information about each Order. For each order, database
needs to store OrderId, OrderDate, and Total dollar amount.
OrderId is unique to each Order. Order example: Order1234
ordered on 3/1/2015, with a dollar amount of $540.
· (For relationships) Database needs to store information about
what products are being ordered in each order.
· (For relationship cardinalities): Each order can contain
multiple products. Each product can appear in multiple orders.
For example, Order1234 ordered SKU78 and SKU72; Order34
ordered SKU72 and SKU83.
· (For relationship attributes): Database needs to store quantity
and price of each product ordered in each order. (Or, for each
product ordered in each order, database needs to store quantity
and price.) For example, Order 1234 ordered Product SKU78 at
$78/unit for 5 units. Order1234 also ordered SKU72 at $60/unit
for 9 units.
Your write-up may benefit from an iterative process whereby
you compare your ERD with your write-up and revise the write-
up if you find that certain information is not contained in the
write-up to allow another person to derive attributes, primary
keys, or cardinalities, or if you find that your ERD does not
match your write up. Give examples of data elements if those
elements are specific to the application environment, because
other people (e.g., your instructor) may not know what they are
(see the next requirement).
· (2 points) Provide sample data for all data requirements as
part of the submission. If the application environment uses any
paper forms to collect data, fill out a set of forms with fictitious
information as sample data and attach those forms as part of the
submission. If the application environment does not use paper
forms, provide screen captures or otherwise provide sample data
(made up data are fine). If your project is made up, provide
made up forms or data.
Step 2): (20 Points) Draw an E-R diagram to document your
application according to your descriptions provided in Step 1),
including the mapping ratios for relationships. The ERD you
draw here should match your descriptions in Step 1, Bullet 4.
Clearly identify attributes of entities and relationships. Each
entity must have a primary key and necessary attributes.
· To save on diagramming effort, you may want to list all
attributes of an entity inside the box for that entity.
· For each entity, underline or otherwise indicate the primary
key.
· If writing out the attributes inside the box crowds the diagram,
list the attributes for each entity separately, beneath the diagram
if there is room, or on a separate page.
· If the meaning of an attribute is not self-explanatory, add
explanations.
You may hand-draw your ERD, or you may use any drawing
tools.
There are many free online drawing tools available, for
example, http://www.draw.io (use a template under Software
Design). ERDplus.com is another good tool. If you’re not using
Visio, Take a screenshot of your ERD and insert the screenshot
as an image in your Word Document. If you’re using Visio,
insert the ERD as an editable image. The solution file for ERD
exercises posted in Canvas were drawn with Visio. You can
copy one and modify it for your own ERD. It would save you
some time this way.
Important
Drawing ERD and converting it to a list of tables is an iterative
process. After drawing the ERD, it’s beneficial to convert that
ERD into a list of tables and then investigate whether the final
tables make sense. This often will give you feedback on your
ERD. However, ERD conversion is not required in Prj1. It’ll be
on Prj2 (because your ERD may change).
2

More Related Content

Similar to When debugging the code, use Drop table statementsto drop pr.docx

EJERCICIOS DE BENFORTAN
EJERCICIOS DE BENFORTANEJERCICIOS DE BENFORTAN
EJERCICIOS DE BENFORTANarkangel8801
 
Use this script for the assignment.Please follow instructions as t.docx
Use this script for the assignment.Please follow instructions as t.docxUse this script for the assignment.Please follow instructions as t.docx
Use this script for the assignment.Please follow instructions as t.docxgarnerangelika
 
Identificacion De Las Llaves Foraneas
Identificacion De Las Llaves ForaneasIdentificacion De Las Llaves Foraneas
Identificacion De Las Llaves Foraneasrobertjeison
 
The resto txt Use for TM254 2021J TMA02 Question 6 .pdf
The resto txt     Use for TM254 2021J TMA02 Question 6 .pdfThe resto txt     Use for TM254 2021J TMA02 Question 6 .pdf
The resto txt Use for TM254 2021J TMA02 Question 6 .pdfgiriraj65
 
BD I - Aula 13 B - Agrupando Dados - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando Dados  - Parte 04 - Exercicios EnunciadoBD I - Aula 13 B - Agrupando Dados  - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando Dados - Parte 04 - Exercicios EnunciadoRodrigo Kiyoshi Saito
 
BD I - Aula 13 B - Agrupando dados - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando dados  - Parte 04 - Exercicios EnunciadoBD I - Aula 13 B - Agrupando dados  - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando dados - Parte 04 - Exercicios EnunciadoRodrigo Kiyoshi Saito
 
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.phpssuserfa5723
 
Scott sql script as per exercise1
Scott sql script as per exercise1Scott sql script as per exercise1
Scott sql script as per exercise1AjayMaheshwari17
 
Work in TDW
Work in TDWWork in TDW
Work in TDWsaso70
 
I have the attached copy of the assignment description. And here is .docx
I have the attached copy of the assignment description. And here is .docxI have the attached copy of the assignment description. And here is .docx
I have the attached copy of the assignment description. And here is .docxsamirapdcosden
 
-- script to create NORTHWOODS database-- revised 8172002 JM .docx
-- script to create NORTHWOODS database-- revised 8172002 JM .docx-- script to create NORTHWOODS database-- revised 8172002 JM .docx
-- script to create NORTHWOODS database-- revised 8172002 JM .docxhoney725342
 
Starting from the database used in Project 1 (see the slightly cha.docx
Starting from the database used in Project 1 (see the slightly cha.docxStarting from the database used in Project 1 (see the slightly cha.docx
Starting from the database used in Project 1 (see the slightly cha.docxdessiechisomjj4
 
Script de creación de la base de datos pedidos en MS Access
Script de creación de la base de datos pedidos en MS AccessScript de creación de la base de datos pedidos en MS Access
Script de creación de la base de datos pedidos en MS AccessZantiago Thrash
 
Tablas, Codigos Base De Datos Excelsa
Tablas, Codigos Base De Datos ExcelsaTablas, Codigos Base De Datos Excelsa
Tablas, Codigos Base De Datos ExcelsaHéctor
 

Similar to When debugging the code, use Drop table statementsto drop pr.docx (20)

EJERCICIOS DE BENFORTAN
EJERCICIOS DE BENFORTANEJERCICIOS DE BENFORTAN
EJERCICIOS DE BENFORTAN
 
Use this script for the assignment.Please follow instructions as t.docx
Use this script for the assignment.Please follow instructions as t.docxUse this script for the assignment.Please follow instructions as t.docx
Use this script for the assignment.Please follow instructions as t.docx
 
Milestone 1 FINAL
Milestone 1 FINALMilestone 1 FINAL
Milestone 1 FINAL
 
Identificacion De Las Llaves Foraneas
Identificacion De Las Llaves ForaneasIdentificacion De Las Llaves Foraneas
Identificacion De Las Llaves Foraneas
 
The resto txt Use for TM254 2021J TMA02 Question 6 .pdf
The resto txt     Use for TM254 2021J TMA02 Question 6 .pdfThe resto txt     Use for TM254 2021J TMA02 Question 6 .pdf
The resto txt Use for TM254 2021J TMA02 Question 6 .pdf
 
BD I - Aula 13 B - Agrupando Dados - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando Dados  - Parte 04 - Exercicios EnunciadoBD I - Aula 13 B - Agrupando Dados  - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando Dados - Parte 04 - Exercicios Enunciado
 
BD I - Aula 13 B - Agrupando dados - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando dados  - Parte 04 - Exercicios EnunciadoBD I - Aula 13 B - Agrupando dados  - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando dados - Parte 04 - Exercicios Enunciado
 
ScottCreate_1.pdf
ScottCreate_1.pdfScottCreate_1.pdf
ScottCreate_1.pdf
 
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 
Scott sql script as per exercise1
Scott sql script as per exercise1Scott sql script as per exercise1
Scott sql script as per exercise1
 
Work in TDW
Work in TDWWork in TDW
Work in TDW
 
I have the attached copy of the assignment description. And here is .docx
I have the attached copy of the assignment description. And here is .docxI have the attached copy of the assignment description. And here is .docx
I have the attached copy of the assignment description. And here is .docx
 
Taler De Refuerz1
Taler De Refuerz1Taler De Refuerz1
Taler De Refuerz1
 
Taller 4
Taller 4Taller 4
Taller 4
 
Sql commands
Sql commandsSql commands
Sql commands
 
-- script to create NORTHWOODS database-- revised 8172002 JM .docx
-- script to create NORTHWOODS database-- revised 8172002 JM .docx-- script to create NORTHWOODS database-- revised 8172002 JM .docx
-- script to create NORTHWOODS database-- revised 8172002 JM .docx
 
Starting from the database used in Project 1 (see the slightly cha.docx
Starting from the database used in Project 1 (see the slightly cha.docxStarting from the database used in Project 1 (see the slightly cha.docx
Starting from the database used in Project 1 (see the slightly cha.docx
 
Script de creación de la base de datos pedidos en MS Access
Script de creación de la base de datos pedidos en MS AccessScript de creación de la base de datos pedidos en MS Access
Script de creación de la base de datos pedidos en MS Access
 
Sql ejercicio 1
Sql ejercicio 1Sql ejercicio 1
Sql ejercicio 1
 
Tablas, Codigos Base De Datos Excelsa
Tablas, Codigos Base De Datos ExcelsaTablas, Codigos Base De Datos Excelsa
Tablas, Codigos Base De Datos Excelsa
 

More from aryan532920

According to the NASW Code of Ethics section 6.04 (NASW, 2008), .docx
According to the NASW Code of Ethics section 6.04 (NASW, 2008), .docxAccording to the NASW Code of Ethics section 6.04 (NASW, 2008), .docx
According to the NASW Code of Ethics section 6.04 (NASW, 2008), .docxaryan532920
 
According to the text, crime has been part of the human condition si.docx
According to the text, crime has been part of the human condition si.docxAccording to the text, crime has been part of the human condition si.docx
According to the text, crime has been part of the human condition si.docxaryan532920
 
According to Ronald Story and Bruce Laurie, The dozen years between.docx
According to Ronald Story and Bruce Laurie, The dozen years between.docxAccording to Ronald Story and Bruce Laurie, The dozen years between.docx
According to Ronald Story and Bruce Laurie, The dozen years between.docxaryan532920
 
According to Kirk (2016), most of your time will be spent work with .docx
According to Kirk (2016), most of your time will be spent work with .docxAccording to Kirk (2016), most of your time will be spent work with .docx
According to Kirk (2016), most of your time will be spent work with .docxaryan532920
 
According to the Council on Social Work Education, Competency 5 Eng.docx
According to the Council on Social Work Education, Competency 5 Eng.docxAccording to the Council on Social Work Education, Competency 5 Eng.docx
According to the Council on Social Work Education, Competency 5 Eng.docxaryan532920
 
According to Kirk (2016), most of our time will be spent working.docx
According to Kirk (2016), most of our time will be spent working.docxAccording to Kirk (2016), most of our time will be spent working.docx
According to Kirk (2016), most of our time will be spent working.docxaryan532920
 
According to Kirk (2016), most of your time will be spent working wi.docx
According to Kirk (2016), most of your time will be spent working wi.docxAccording to Kirk (2016), most of your time will be spent working wi.docx
According to Kirk (2016), most of your time will be spent working wi.docxaryan532920
 
According to Davenport (2014) the organizational value of healthcare.docx
According to Davenport (2014) the organizational value of healthcare.docxAccording to Davenport (2014) the organizational value of healthcare.docx
According to Davenport (2014) the organizational value of healthcare.docxaryan532920
 
According to the authors, privacy and security go hand in hand; .docx
According to the authors, privacy and security go hand in hand; .docxAccording to the authors, privacy and security go hand in hand; .docx
According to the authors, privacy and security go hand in hand; .docxaryan532920
 
According to Gilbert and Troitzsch (2005), Foundations of Simula.docx
According to Gilbert and Troitzsch (2005), Foundations of Simula.docxAccording to Gilbert and Troitzsch (2005), Foundations of Simula.docx
According to Gilbert and Troitzsch (2005), Foundations of Simula.docxaryan532920
 
According to Klein (2016), using ethical absolutism and ethical .docx
According to Klein (2016), using ethical absolutism and ethical .docxAccording to Klein (2016), using ethical absolutism and ethical .docx
According to Klein (2016), using ethical absolutism and ethical .docxaryan532920
 
According to Franks and Smallwood (2013), information has become.docx
According to Franks and Smallwood (2013), information has become.docxAccording to Franks and Smallwood (2013), information has become.docx
According to Franks and Smallwood (2013), information has become.docxaryan532920
 
According to the Council on Social Work Education, Competency 5.docx
According to the Council on Social Work Education, Competency 5.docxAccording to the Council on Social Work Education, Competency 5.docx
According to the Council on Social Work Education, Competency 5.docxaryan532920
 
According to the authors, privacy and security go hand in hand; and .docx
According to the authors, privacy and security go hand in hand; and .docxAccording to the authors, privacy and security go hand in hand; and .docx
According to the authors, privacy and security go hand in hand; and .docxaryan532920
 
According to recent surveys, China, India, and the Philippines are t.docx
According to recent surveys, China, India, and the Philippines are t.docxAccording to recent surveys, China, India, and the Philippines are t.docx
According to recent surveys, China, India, and the Philippines are t.docxaryan532920
 
According to the authors, countries that lag behind the rest of the .docx
According to the authors, countries that lag behind the rest of the .docxAccording to the authors, countries that lag behind the rest of the .docx
According to the authors, countries that lag behind the rest of the .docxaryan532920
 
According to Peskin et al. (2013) in our course reader, Studies on .docx
According to Peskin et al. (2013) in our course reader, Studies on .docxAccording to Peskin et al. (2013) in our course reader, Studies on .docx
According to Peskin et al. (2013) in our course reader, Studies on .docxaryan532920
 
According to Franks and Smallwood (2013), information has become the.docx
According to Franks and Smallwood (2013), information has become the.docxAccording to Franks and Smallwood (2013), information has become the.docx
According to Franks and Smallwood (2013), information has become the.docxaryan532920
 
According to Ang (2011), how is Social Media management differen.docx
According to Ang (2011), how is Social Media management differen.docxAccording to Ang (2011), how is Social Media management differen.docx
According to Ang (2011), how is Social Media management differen.docxaryan532920
 
According to (Alsaidi & Kausar (2018), It is expected that by 2020,.docx
According to (Alsaidi & Kausar (2018), It is expected that by 2020,.docxAccording to (Alsaidi & Kausar (2018), It is expected that by 2020,.docx
According to (Alsaidi & Kausar (2018), It is expected that by 2020,.docxaryan532920
 

More from aryan532920 (20)

According to the NASW Code of Ethics section 6.04 (NASW, 2008), .docx
According to the NASW Code of Ethics section 6.04 (NASW, 2008), .docxAccording to the NASW Code of Ethics section 6.04 (NASW, 2008), .docx
According to the NASW Code of Ethics section 6.04 (NASW, 2008), .docx
 
According to the text, crime has been part of the human condition si.docx
According to the text, crime has been part of the human condition si.docxAccording to the text, crime has been part of the human condition si.docx
According to the text, crime has been part of the human condition si.docx
 
According to Ronald Story and Bruce Laurie, The dozen years between.docx
According to Ronald Story and Bruce Laurie, The dozen years between.docxAccording to Ronald Story and Bruce Laurie, The dozen years between.docx
According to Ronald Story and Bruce Laurie, The dozen years between.docx
 
According to Kirk (2016), most of your time will be spent work with .docx
According to Kirk (2016), most of your time will be spent work with .docxAccording to Kirk (2016), most of your time will be spent work with .docx
According to Kirk (2016), most of your time will be spent work with .docx
 
According to the Council on Social Work Education, Competency 5 Eng.docx
According to the Council on Social Work Education, Competency 5 Eng.docxAccording to the Council on Social Work Education, Competency 5 Eng.docx
According to the Council on Social Work Education, Competency 5 Eng.docx
 
According to Kirk (2016), most of our time will be spent working.docx
According to Kirk (2016), most of our time will be spent working.docxAccording to Kirk (2016), most of our time will be spent working.docx
According to Kirk (2016), most of our time will be spent working.docx
 
According to Kirk (2016), most of your time will be spent working wi.docx
According to Kirk (2016), most of your time will be spent working wi.docxAccording to Kirk (2016), most of your time will be spent working wi.docx
According to Kirk (2016), most of your time will be spent working wi.docx
 
According to Davenport (2014) the organizational value of healthcare.docx
According to Davenport (2014) the organizational value of healthcare.docxAccording to Davenport (2014) the organizational value of healthcare.docx
According to Davenport (2014) the organizational value of healthcare.docx
 
According to the authors, privacy and security go hand in hand; .docx
According to the authors, privacy and security go hand in hand; .docxAccording to the authors, privacy and security go hand in hand; .docx
According to the authors, privacy and security go hand in hand; .docx
 
According to Gilbert and Troitzsch (2005), Foundations of Simula.docx
According to Gilbert and Troitzsch (2005), Foundations of Simula.docxAccording to Gilbert and Troitzsch (2005), Foundations of Simula.docx
According to Gilbert and Troitzsch (2005), Foundations of Simula.docx
 
According to Klein (2016), using ethical absolutism and ethical .docx
According to Klein (2016), using ethical absolutism and ethical .docxAccording to Klein (2016), using ethical absolutism and ethical .docx
According to Klein (2016), using ethical absolutism and ethical .docx
 
According to Franks and Smallwood (2013), information has become.docx
According to Franks and Smallwood (2013), information has become.docxAccording to Franks and Smallwood (2013), information has become.docx
According to Franks and Smallwood (2013), information has become.docx
 
According to the Council on Social Work Education, Competency 5.docx
According to the Council on Social Work Education, Competency 5.docxAccording to the Council on Social Work Education, Competency 5.docx
According to the Council on Social Work Education, Competency 5.docx
 
According to the authors, privacy and security go hand in hand; and .docx
According to the authors, privacy and security go hand in hand; and .docxAccording to the authors, privacy and security go hand in hand; and .docx
According to the authors, privacy and security go hand in hand; and .docx
 
According to recent surveys, China, India, and the Philippines are t.docx
According to recent surveys, China, India, and the Philippines are t.docxAccording to recent surveys, China, India, and the Philippines are t.docx
According to recent surveys, China, India, and the Philippines are t.docx
 
According to the authors, countries that lag behind the rest of the .docx
According to the authors, countries that lag behind the rest of the .docxAccording to the authors, countries that lag behind the rest of the .docx
According to the authors, countries that lag behind the rest of the .docx
 
According to Peskin et al. (2013) in our course reader, Studies on .docx
According to Peskin et al. (2013) in our course reader, Studies on .docxAccording to Peskin et al. (2013) in our course reader, Studies on .docx
According to Peskin et al. (2013) in our course reader, Studies on .docx
 
According to Franks and Smallwood (2013), information has become the.docx
According to Franks and Smallwood (2013), information has become the.docxAccording to Franks and Smallwood (2013), information has become the.docx
According to Franks and Smallwood (2013), information has become the.docx
 
According to Ang (2011), how is Social Media management differen.docx
According to Ang (2011), how is Social Media management differen.docxAccording to Ang (2011), how is Social Media management differen.docx
According to Ang (2011), how is Social Media management differen.docx
 
According to (Alsaidi & Kausar (2018), It is expected that by 2020,.docx
According to (Alsaidi & Kausar (2018), It is expected that by 2020,.docxAccording to (Alsaidi & Kausar (2018), It is expected that by 2020,.docx
According to (Alsaidi & Kausar (2018), It is expected that by 2020,.docx
 

Recently uploaded

internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Recently uploaded (20)

internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

When debugging the code, use Drop table statementsto drop pr.docx

  • 1. /* When debugging the code, use Drop table statements to drop previously created tables. When code is re-run, new tables will be created. This allows easy debugging. */ Drop table dept cascade constraints; Drop table emp cascade constraints; Drop table customer cascade constraints; Drop table product cascade constraints; Drop table ord cascade constraints; Drop table item cascade constraints; Drop table salgrade cascade constraints; Drop table bonus cascade constraints; Drop table price cascade constraints; Drop table dummy cascade constraints; Purge RecycleBin;
  • 2. CREATE TABLE DEPT ( DEPTNO NUMBER(2) NOT NULL, DNAME VARCHAR2(14), LOC VARCHAR2(13), CONSTRAINT DEPT_PRIMARY_KEY PRIMARY KEY (DEPTNO)); INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK'); INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS'); INSERT INTO DEPT VALUES (30,'SALES','CHICAGO'); INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON'); CREATE TABLE EMP ( EMPNO NUMBER(4) NOT NULL, ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4) CONSTRAINT EMP_MGR_FK
  • 3. REFERENCES EMP (EMPNO), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2) NOT NULL, CONSTRAINT EMP_DEPTNO_FK FOREIGN KEY (DEPTNO) REFERENCES DEPT (DEPTNO), CONSTRAINT EMP_EMPNO_PK PRIMARY KEY (EMPNO)); INSERT INTO EMP VALUES (7839,'KING','PRESIDENT',NULL,TO_DATE('17-NOV- 2011','DD-MON-YYYY'),15000,NULL,10); INSERT INTO EMP VALUES (7698,'Blake','MANAGER',7839,TO_DATE('1-MAY-2012','DD- MON-YYYY'),6850,NULL,30); INSERT INTO EMP VALUES (7782,'CLARK','MANAGER',7839,TO_DATE('9-JUN- 2013','DD-MON-YYYY'),5450,NULL,10); INSERT INTO EMP VALUES (7566,'Jones','MANAGER',7839,TO_DATE('2-APR-2011','DD- MON-YYYY'),5975,NULL,20); INSERT INTO EMP VALUES (7654,'Martin','SALESMAN',7698,TO_DATE('28-SEP- 2012','DD-MON-YYYY'),4250,27400,30); INSERT INTO EMP VALUES
  • 4. (7499,'ALLEN','SALESMAN',7698,TO_DATE('20-FEB- 2013','DD-MON-YYYY'),3600,16300,30); INSERT INTO EMP VALUES (7844,'TURNER','SALESMAN',7698,TO_DATE('8-SEP- 2014','DD-MON-YYYY'),3500,0,30); INSERT INTO EMP VALUES (7900,'James','CLERK',7698,TO_DATE('3-DEC-2015','DD- MON-YYYY'),4950,NULL,30); INSERT INTO EMP VALUES (7521,'WARD','SALESMAN',7698,TO_DATE('22-FEB- 2016','DD-MON-YYYY'),3250,55500,30); INSERT INTO EMP VALUES (7902,'ford','ANALYST',7566,TO_DATE('3-DEC-2016','DD- MON-YYYY'),6000,NULL,20); INSERT INTO EMP VALUES (7369,'SMITH','CLERK',7902,TO_DATE('17-DEC-2015','DD- MON-YYYY'),3800,NULL,20); INSERT INTO EMP VALUES (7788,'SCOTT','ANALYST',7566,TO_DATE('09-DEC- 2014','DD-MON-YYYY'),6000,NULL,20); INSERT INTO EMP VALUES (7876,'ADAMS','CLERK',7788,TO_DATE('12-JAN-2013','DD- MON-YYYY'),4100,NULL,20); INSERT INTO EMP VALUES (7934,'MILLER','CLERK',7782,TO_DATE('23-JAN-2016','DD- MON-YYYY'),4300,NULL,10);
  • 5. CREATE TABLE BONUS ( ENAME VARCHAR2(10), JOB VARCHAR2(9), SAL NUMBER, COMM NUMBER); CREATE TABLE SALGRADE ( GRADE NUMBER, LOSAL NUMBER, HISAL NUMBER); INSERT INTO SALGRADE VALUES (1,700,1200); INSERT INTO SALGRADE VALUES (2,1201,1400); INSERT INTO SALGRADE VALUES (3,1401,2000); INSERT INTO SALGRADE VALUES (4,2001,3000); INSERT INTO SALGRADE VALUES (5,3001,9999); CREATE TABLE DUMMY ( DUMMY NUMBER );
  • 6. INSERT INTO DUMMY VALUES (0); CREATE TABLE CUSTOMER ( CUSTID NUMBER (6) NOT NULL, NAME VARCHAR2 (45), ADDRESS VARCHAR2 (40), CITY VARCHAR2 (30), STATE VARCHAR2 (2), ZIP VARCHAR2 (9), AREA NUMBER (3), PHONE VARCHAR2 (9), REPID NUMBER (4) NOT NULL, CREDITLIMIT NUMBER (9,2), COMMENTS VARCHAR2 (256), CONSTRAINT CUSTOMER_CUSTID_PK PRIMARY KEY (CUSTID), CONSTRAINT CUSTOMER_CUSTID_CK CHECK (CUSTID > 0));
  • 7. CREATE TABLE ORD ( ORDID NUMBER (4) NOT NULL, ORDERDATE DATE, COMMPLAN VARCHAR2 (1), CUSTID NUMBER (6) NOT NULL, SHIPDATE DATE, TOTAL NUMBER (8,2) CONSTRAINT ORD_TOTAL_CK CHECK (TOTAL >= 0), CONSTRAINT ORD_CUSTID_FK FOREIGN KEY (CUSTID) REFERENCES CUSTOMER (CUSTID), CONSTRAINT ORD_ORDID_PK PRIMARY KEY (ORDID)); CREATE TABLE ITEM ( ORDID NUMBER (4) NOT NULL, ITEMID NUMBER (4) NOT NULL, PRODID NUMBER (6), ACTUALPRICE NUMBER (8,2), QTY NUMBER (8), ITEMTOT NUMBER (8,2),
  • 8. CONSTRAINT ITEM_ORDID_FK FOREIGN KEY (ORDID) REFERENCES ORD (ORDID), CONSTRAINT ITEM_ORDID_ITEMID_PK PRIMARY KEY (ORDID,ITEMID)); CREATE TABLE PRODUCT ( PRODID NUMBER (6) CONSTRAINT PRODID_PK PRIMARY KEY, DESCRIP VARCHAR2 (30)); CREATE TABLE PRICE ( PRODID NUMBER (6) NOT NULL, STDPRICE NUMBER (8,2), MINPRICE NUMBER (8,2), STARTDATE DATE, ENDDATE DATE); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS)
  • 9. VALUES ('96711', 'CA', '7844', '598-6609', 'JOCKSPORTS', '100', '5000', 'BELMONT', '415', '345 VIEWRIDGE', 'Very friendly people to work with -- sales rep likes to be called Mike.'); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS) VALUES ('94061', 'CA', '7521', '368-1223', 'TKB SPORT SHOP', '101', '10000', 'REDWOOD CITY', '415', '490 BOLI RD.', 'Rep called 5/8 about change in order - contact shipping.'); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS) VALUES ('95133', 'CA', '7654', '644-3341', 'VOLLYRITE', '102', '7000', 'BURLINGAME', '415', '9722 HAMILTON', 'Company doing heavy promotion beginning 10/89. Prepare for large orders during
  • 10. winter.'); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS) VALUES ('97544', 'CA', '7521', '677-9312', 'JUST TENNIS', '103', '3000', 'BURLINGAME', '415', 'HILLVIEW MALL', 'Contact rep about new line of tennis rackets.'); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS) VALUES ('93301', 'CA', '7499', '996-2323', 'EVERY MOUNTAIN', '104', '10000', 'CUPERTINO', '408', '574 SUYYYYY RD.', 'Customer with high market share (23%) due to aggressive advertising.'); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS) VALUES ('91003', 'CA', '7844', '376-9966',
  • 11. 'K + T SPORTS', '105', '5000', 'SANTA CLARA', '408', '3476 EL PASEO', 'Tends to order large amounts of merchandise at once. Accounting is considering raising their credit limit. Usually pays on time.'); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS) VALUES ('94301', 'CA', '7521', '364-9777', 'SHAPE UP', '106', '6000', 'PALO ALTO', '415', '908 SEQUOIA', 'Support intensive. Orders small amounts (< 800) of merchandise at a time.'); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS) VALUES ('93301', 'CA', '7499', '967-4398', 'WOMENS SPORTS', '107', '10000', 'SUNNYVALE', '408', 'VALCO VILLAGE', 'First sporting goods store geared exclusively towards women.
  • 12. Unusual promotion al style and very willing to take chances towards new products!'); INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT, CITY, AREA, ADDRESS, COMMENTS) VALUES ('55649', 'MN', '7844', '566-9123', 'NORTH WOODS HEALTH AND FITNESS SUPPLY CENTER', '108', '8000', 'HIBBING', '612', '98 LONE PINE WAY', ''); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('101.4', TO_DATE('08-JAN-2017','DD-MON- YYYY'), '610', TO_DATE('07-JAN-2017','DD-MON-YYYY'), '101', 'A'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('45', TO_DATE('11-JAN-2017','DD-MON-YYYY'), '611', TO_DATE('11-JAN-2017','DD-MON-YYYY'), '102', 'B'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('5860', TO_DATE('20-JAN-2017','DD-MON-
  • 13. YYYY'), '612', TO_DATE('15-JAN-2017','DD-MON-YYYY'), '104', 'C'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('2.4', TO_DATE('30-MAY-2016','DD-MON- YYYY'), '601', TO_DATE('01-MAY-2016','DD-MON-YYYY'), '106', 'A'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('56', TO_DATE('20-JUN-2016','DD-MON-YYYY'), '602', TO_DATE('05-JUN-2016','DD-MON-YYYY'), '102', 'B'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('698', TO_DATE('30-JUN-2016','DD-MON-YYYY'), '604', TO_DATE('15-JUN-2016','DD-MON-YYYY'), '106', 'A'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('8324',TO_DATE( '30-JUL-2016','DD-MON- YYYY'), '605', TO_DATE('14-JUL-2016','DD-MON-YYYY'), '106', 'A'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('3.4', TO_DATE('30-JUL-2016','DD-MON-YYYY'), '606', TO_DATE('14-JUL-2016','DD-MON-YYYY'), '100', 'A'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID,
  • 14. ORDERDATE, CUSTID, COMMPLAN) VALUES ('97.5', TO_DATE('15-AUG-2016','DD-MON- YYYY'), '609', TO_DATE('01-AUG-2016','DD-MON-YYYY'), '100', 'B'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('5.6', TO_DATE('18-JUL-2016','DD-MON-YYYY'), '607', TO_DATE('18-JUL-2016','DD-MON-YYYY'), '104', 'C'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('35.2', TO_DATE('25-JUL-2016','DD-MON- YYYY'), '608', TO_DATE('25-JUL-2016','DD-MON-YYYY'), '104', 'C'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('224', TO_DATE('05-JUN-2016','DD-MON-YYYY'), '603', TO_DATE('05-JUN-2016','DD-MON-YYYY'), '102', ''); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('4450', TO_DATE('12-MAR-2017','DD-MON- YYYY'), '620', TO_DATE('12-MAR-2017','DD-MON-YYYY'), '100', ''); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('6400', TO_DATE('01-FEB-2017','DD-MON-
  • 15. YYYY'), '613', TO_DATE('01-FEB-2017','DD-MON-YYYY'), '108', ''); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('23940', TO_DATE('05-FEB-2017','DD-MON- YYYY'), '614', TO_DATE('01-FEB-2017','DD-MON-YYYY'), '102', ''); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('764', TO_DATE('10-FEB-2017','DD-MON-YYYY'), '616', TO_DATE('03-FEB-2017','DD-MON-YYYY'), '103', ''); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('1260', TO_DATE('04-FEB-2017','DD-MON- YYYY'), '619', TO_DATE('22-FEB-2017','DD-MON-YYYY'), '104', ''); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('46370', TO_DATE('03-MAR-2017','DD-MON- YYYY'), '617', TO_DATE('05-FEB-2017','DD-MON-YYYY'), '105', ''); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('710', TO_DATE('06-FEB-2017','DD-MON-YYYY'), '615', TO_DATE('01-FEB-2017','DD-MON-YYYY'), '107', '');
  • 16. INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('3510.5', TO_DATE('06-MAR-2017','DD-MON- YYYY'), '618', TO_DATE('15-FEB-2017','DD-MON-YYYY'), '102', 'A'); INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN) VALUES ('730', TO_DATE('01-JAN-17','DD-MON-YYYY'), '621', TO_DATE('15-MAR-2017','DD-MON-YYYY'), '100', 'A'); INSERT INTO ITEM (QTY, PRODID, ORDID, ITEMTOT, ITEMID, ACTUALPRICE) VALUES ('1', '100890', '610', '58', '3', '58'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '1', '100861', '611', '45', '1', '45'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '100', '100860', '612', '3000', '1', '30'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '1', '200376', '601', '2.4', '1', '2.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
  • 17. VALUES ( '20', '100870', '602', '56', '1', '2.8'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '3', '100890', '604', '174', '1', '58'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '2', '100861', '604', '84', '2', '42'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '10', '100860', '604', '440', '3', '44'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '4', '100860', '603', '224', '2', '56'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '1', '100860', '610', '35', '1', '35'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '3', '100870', '610', '8.4', '2', '2.8'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
  • 18. VALUES ( '200', '200376', '613', '440', '4', '2.2'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '444', '100860', '614', '15540', '1', '35'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '1000', '100870', '614', '2800', '2', '2.8'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '20', '100861', '612', '810', '2', '40.5'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('150', '101863', '612', '1500', '3', '10'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('10', '100860', '620', '350', '1', '35'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('1000', '200376', '620', '2400', '2', '2.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('500', '102130', '620', '1700', '3', '3.4');
  • 19. INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ( '100', '100871', '613', '560', '1', '5.6'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('200', '101860', '613', '4800', '2', '24'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('150', '200380', '613', '600', '3', '4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '102130', '619', '340', '3', '3.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('50', '100860', '617', '1750', '1', '35'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '100861', '617', '4500', '2', '45'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('1000', '100871', '614', '5600', '3', '5.6');
  • 20. INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('10', '100861', '616', '450', '1', '45'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('50', '100870', '616', '140', '2', '2.8'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('2', '100890', '616', '116', '3', '58'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('10', '102130', '616', '34', '4', '3.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('10', '200376' , '616', '24', '5', '2.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '200380', '619', '400', '1', '4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '200376', '619', '240', '2', '2.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT ,
  • 21. ITEMID , ACTUALPRICE) VALUES ('4', '100861', '615', '180', '1', '45'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('1', '100871', '607', '5.6', '1', '5.6'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '100870', '615', '280', '2', '2.8'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('500', '100870', '617', '1400', '3', '2.8'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('500', '100871', '617', '2800', '4', '5.6'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('500', '100890', '617', '29000', '5', '58'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '101860', '617', '2400', '6', '24'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
  • 22. VALUES ('200', '101863', '617', '2500', '7', '12.5'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '102130', '617', '340', '8', '3.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('200', '200376', '617', '480', '9', '2.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('300', '200380', '617', '1200', '10', '4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('5', '100870', '609', '12.5', '2', '2.5'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('1', '100890', '609', '50', '3', '50'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('23', '100860', '618', '805', '1', '35'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
  • 23. VALUES ('50', '100861', '618', '2255.5', '2', '45.11'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('10', '100870', '618', '450', '3', '45'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('10', '100861', '621', '450', '1', '45'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '100870', '621', '280', '2', '2.8'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('50', '100871', '615', '250', '3', '5'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('1', '101860', '608', '24', '1', '24'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('2', '100871', '608', '11.2', '2', '5.6'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('1', '100861', '609', '35', '1', '35');
  • 24. INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('1', '102130', '606', '3.4', '1', '3.4'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '100861', '605', '4500', '1', '45'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('500', '100870', '605', '1400', '2', '2.8'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('5', '100890', '605', '290', '3', '58'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('50', '101860', '605', '1200', '4', '24'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '101863', '605', '900', '5', '9'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('10', '102130', '605', '34', '6', '3.4');
  • 25. INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('100', '100871', '612', '550', '4', '5.5'); INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE) VALUES ('50', '100871', '619', '280', '4', '5.6'); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('4.8', TO_DATE('01-JAN-2016','DD-MON-YYYY'), '100871', '3.2', TO_DATE('01-DEC-2016','DD-MON-YYYY')); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('54', TO_DATE('01-JAN-2016','DD-MON-YYYY'), '100890', '40.5', TO_DATE('31-JUL-2016','DD-MON-YYYY')); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('58', TO_DATE('01-AUG-2016','DD-MON-YYYY'), '100890', '46.4', ''); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('30', TO_DATE('01-JAN-2016','DD-MON-YYYY'),
  • 26. '100860', '24', TO_DATE('31-DEC-2016','DD-MON-YYYY')); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('32', TO_DATE('01-JAN-2017','DD-MON-YYYY'), '100860', '25.6', TO_DATE('31-MAY-2017','DD-MON- YYYY')); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('35', TO_DATE('01-JUN-2017','DD-MON-YYYY'), '100860', '28', ''); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('39', TO_DATE('01-JAN-2016','DD-MON-YYYY'), '100861', '31.2', TO_DATE('31-DEC-2016','DD-MON-YYYY')); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('42', TO_DATE('01-JAN-2017','DD-MON-YYYY'), '100861', '33.6', TO_DATE('31-MAY-2017','DD-MON- YYYY')); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('45', TO_DATE('01-JUN-2017','DD-MON-YYYY'),
  • 27. '100861', '36', ''); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('2.4', TO_DATE('01-JAN-2016','DD-MON-YYYY'), '100870', '1.9', TO_DATE('01-DEC-2016','DD-MON-YYYY')); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('2.8', TO_DATE('01-JAN-2017','DD-MON-YYYY'), '100870', '2.4', ''); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('5.6', TO_DATE('01-JAN-2016','DD-MON-YYYY'), '100871', '4.8', ''); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('24', TO_DATE('01-JAN-2016','DD-MON-YYYY'), '101860', '18', '');
  • 28. INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('12.5', TO_DATE('01-JAN-2016','DD-MON- YYYY'), '101863', '9.4', ''); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('3.4',TO_DATE( '01-JAN-2016','DD-MON-YYYY'), '102130', '2.8', ''); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('2.4', TO_DATE('01-JAN-2016','DD-MON-YYYY'), '200376', '1.75', ''); INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE) VALUES ('4', TO_DATE('01-JAN-2016','DD-MON-YYYY'), '200380', '3.2', ''); CREATE INDEX PRICE_INDEX ON PRICE(PRODID, STARTDATE); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('100860', 'ACE TENNIS RACKET I');
  • 29. INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('100861', 'ACE TENNIS RACKET II'); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('100870', 'ACE TENNIS BALLS-3 PACK'); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('100871', 'ACE TENNIS BALLS-6 PACK'); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('100890', 'ACE TENNIS NET'); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('101860', 'SP TENNIS RACKET'); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('101863', 'SP JUNIOR RACKET'); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('102130', 'RH: "GUIDE TO TENNIS"'); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('200376', 'SB ENERGY BAR-6 PACK'); INSERT INTO PRODUCT (PRODID, DESCRIP) VALUES ('200380', 'SB VITA SNACK-6 PACK');
  • 30. commit; set feedback off cl screen set heading off /* Drop Table statements are used during the code debugging stage. Once code is correct, they are no longer needed. However, one can keep the statements for re-creating the initial tables later.*/ drop table TranDetail cascade constraints; drop table Book cascade constraints; drop table Tran cascade constraints; drop table BookType cascade constraints; drop table Student cascade constraints;
  • 31. purge recyclebin; Create table TranDetail (TranID number(4), Bcode varchar2(5), ReturnDate Date); insert into TranDetail values (1,'3330', to_date('3/5/2015 14:15:31','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (1,'9440', to_date('3/6/2015 11:00:21','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (2,'2220', to_date('3/8/2015 12:05:35','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (2,'2510', to_date('3/9/2015 13:32:45','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (3,'2740', to_date('3/9/2016 9:06:07','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (4,'3330', to_date('3/8/2016 8:30:46','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (4,'9440', to_date('3/8/2016 9:40:23','dd/mm/yyyy hh24:mi:ss'));
  • 32. insert into TranDetail values (5,'1510', to_date('4/5/2016 15:09:45','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (5,'2220', to_date('4/6/2016 19:34:56','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (5,'2510', to_date('4/7/2016 8:56:12','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (6,'2510', to_date('5/6/2016 16:15:34','dd/mm/yyyy hh24:mi:ss')); insert into TranDetail values (7,'2740', to_date('5/5/2016 11:04:09','dd/mm/yyyy hh24:mi:ss')); Create table Book (Bookcode varchar2(5) primary key, Title varchar2(35), Type varchar2(20)); insert into Book values ('1510','True confessions','Mistery'); insert into Book values ('2220','The big','Drama'); insert into Book values ('2510','The little mermaid','Children'); insert into Book values ('2740','Backdraft','Action'); insert into Book values ('3330','Steve Jobs','Biograph');
  • 33. insert into Book values ('9440','Other world','Science Fiction'); Create table Tran (TranID number(4) primary key, StudentId varchar2(10), TranDateAndTime date); insert into Tran values (1,'1002', to_date('3/4/2015 9:45:15','dd/mm/yyyy hh24:mi:ss')); insert into Tran values (2,'1003', to_date('3/5/2015 15:00:23','dd/mm/yyyy hh24:mi:ss')); insert into Tran values (3,'1003', to_date('3/6/2016 14:00:45','dd/mm/yyyy hh24:mi:ss')); insert into Tran values (4,'1004', to_date('3/7/2016 8:45:34','dd/mm/yyyy hh24:mi:ss')); insert into Tran values (5,'1005', to_date('4/2/2016 9:00:21','dd/mm/yyyy hh24:mi:ss')); insert into Tran values (6,'1001', to_date('5/2/2016 16:15:44','dd/mm/yyyy hh24:mi:ss')); insert into Tran values (7,'1003', to_date('5/4/2016 15:00:51','dd/mm/yyyy hh24:mi:ss'));
  • 34. create table Booktype (typename varchar2(25) primary key, avgscore number(4,2)); insert into Booktype values('Action',3.00); insert into Booktype values('Biography',2.50); insert into Booktype values('Children',4.00); insert into Booktype values('Drama',3.50); insert into Booktype values('Mistery',3.50); insert into Booktype values('Science Fiction',3.50); Create table Student (StudentId varchar2(10) primary key, Fname varchar2(20), LName varchar2(25), address varchar2(25), city varchar2(15),
  • 35. State char(2), Zip varchar2(5), Phone varchar2(12), RegDate Date); insert into Student values ('1001','Jerry','Seidmann','10 East Ave','Englewood','CO','80111','303-429-2778',to_date('30-3- 2002','dd-mm-yyyy')); insert into Student values ('1002','Mary','Taylor','37 South Ave','Centennial','CO','80112','303-429-8990',to_date('2-4- 2004','dd-mm-yyyy')); insert into Student values ('1003','Hugh','Ryan','68 Main St.','Denver','CO','80202','429-742-7243',to_date('1-5-1994','dd- mm-yyyy')); insert into Student values ('1004','Robert','Russell','98 Lakeside Dr.','Denver','CO','80217','720-643-7889',to_date('4-8-2014','dd- mm-yyyy')); insert into Student values ('1005','David','Stafford','80 River Rd.','Bloomfield','CO','80020','303-447-1435',to_date('5-8- 2012','dd-mm-yyyy')); set feedback on commit;
  • 36. set heading on Students may form groups of 1-3 students for the project. One page project proposal requirements Please see the following four pages concerning where to find a project, what projects are unsuitable, and the originality requirements of the project. For the one-page proposal on the project chosen, briefly address these points: · Describe background of the company; · Describe relevant daily business operations and information needed for or generated from those daily business operations. These daily business operations require information as inputs and/or generate information as outputs so it would benefit from having relevant input and output information stored in a database. For example, if the project chosen is for a store, the daily operation is customer’s making purchases. You would say something like this: “Customers come to the store to select products they want to buy. When they check out, the system (the store) calculates the total due (relevant daily business operations). After the customer pays for the purchase, the store gives the customer a receipt. These daily business operations require price information for each product and quantity information for each product purchased by the customer (Inputs) in order to calculate the total due. After the transaction is completed, the system
  • 37. (store) stores that this transaction has taken placed, with details about what were bought, how many, and at what prices (outputs).” · Problems with the current way of information (data) management · Proposed way of data management (i.e., what data to store in the database and what functionalities to provide in the interface) · What is your project source? (See Pages 2-3) · How and from whom would you obtain data requirements for the database? · Who would be the intended users of your database? · If possible for your project source, provide sample data (modify any confidential data to preserve confidentiality. In fact, actual data are NOT needed, only fictitious data that look like the actual data are needed.) If sample data come on hard copies of filled-out forms, blank forms filled with fictitious data that look like the real data are sufficient. You won’t be receiving a grade for this one-page project proposal. The purpose of the report is to communicate your topic selection to me so I can help you decide whether or not the project is appropriate. Hand in your hard-copy project proposal in class on or before the due date listed in Canvas and in the Syllabus. Electronic submissions to Canvas are also accepted. Avoid unsuitable projects (See Page 4). You may change your project idea later if you later find a better project idea. Please provide another one-page project proposal as described above if that happens. Submitting this concept of a database for approval indicates that you claim the originality of this project (See Pages 4-5). In the next stage of the project, you’ll need to collect detailed
  • 38. information about what data are needed for those businesses operations, what data are generated that need to be stored in the database, and how data relate to each other, that is, business rules concerning the data. When designing the ERD, having sample data will help you understand the data better. However, when eventually submitting your database for grading, fictitious data are sufficient.Size of the project The ideal size of the project is 5-7 tables.Database Project Sources Decide on an application for which you’ll design the database. Choose a project where the main purpose is to store and retrieve operational data. The preferred project is one intended for some real user(s) (including family and friends). A database intended for your own use is ok. A made up database with imagined users is not recommended though acceptable. Here I discuss four sources of database projects (Pages 2-3). Unsuitable projects are discussed on Page 4.Project Source 1: Organic The most organic source of a database project is through your network of friends, family members, acquaintances, or your own work place. Many solo or other types of small businesses do not already have a database for their day-to-day business operations. Even some medium or large sized companies may need a small database for non-mission-critical things like employee training, various task forces, internal “instance” reports and such, even though they usually have databases for their core day-to-day business operations. Here are some organically sourced project examples done by students in the past: · A database for a bed-and-breakfast place owned by a student’s parents. The database keeps track of reservations, checking in, checking out, and pricing.
  • 39. · A database for a tree farm owned by a student’s parents that stores information about various trees grown on the farm, customer orders, and tree deliveries. · A database for a daycare center operated by a student’s spouse that stores information about the children, check-in and check- out times on each day for each child, and their account balances and payment information. · A database that stores prospective real estate clients, viewings, and mailings information for a student’s friend. · A database that stores information about employee training, courses they took, and certifications information for a student’s workplace. · A database that stores information about various small medical devices that patients can rent out for a student’s workplace. · A database that keeps track of various computing devices of employees, licenses of applications, connections to various servers etc. for a student’s workplaceProject Source 2: Reverse engineering a database If you really can’t find an organic project, before deciding on a made-up project, try reverse engineering. Reverse engineering is to design a database based on your interactions with an existing database on the desktop or on the Web. For example, if you work as a human resources specialist at a company and use a human resources management software, you can design a database based on your knowledge of the type of information stored in the human resources database and the type of interactions it affords the user. If you work or worked at a store that sells and resells computer games and have used the sales database, you can design a database based on your knowledge and interactions with that database. You may also interact with databases on the web (example, Amazon.com’s vast database). You can design the database (a part of it) based on your interactions with the ecommerce site. Do Review Page 4 for originality requirements for reverse
  • 40. reengineering.Project Source 3: Preferred way of making up a database If you still can’t find an organic project and can’t find a database to reverse engineer, the preferred way of making up a database project is to base your database on a real business that you’re familiar with. As mentioned before, medium sized or large companies usually already have databases to support their day-to-day core business operations. If you work or worked for a company and are familiar with the core business, you may make up a database that would support the daily operations of that company or that would support some other business operations that you’re familiar with.Project Source 4: Desperate way of making up a project If no one in your network seems in need of a database, you have not interacted with a database that could offer reverse engineering, you have not worked for any company that used a database, and you have not worked in a company that can give you inspirations for a database idea, and you don’t know anyone who may be able to help you get a project idea, in short, if you are desperate, then imagine an organization or a business and imagine how that organization or business work and proceed to design your database. If you decide to proceed with a made-up database, your database needs to be substantially different from any of the examples or homework problems that I have written up. Also talk to me first before choosing this route. Unsuitable Projects 1. 1-3 tables: If a database project will end up having only 1-3 tables, it is not suitable because such a project, though maybe valuable, does not offer you the opportunity to practice ERD or table design. Examples are NFL team stats database (one table), catalog of books (book table and category table-2 tables), customer complaints database (complaints table --1 table). An ideal project should have about 5-7 tables –complex enough to
  • 41. offer ERD and table design practices and small enough to do as a class project. 2. Database problems involving other main tasks such as synchronizing data from multiple databases, integrating one database into another, automatic uploading of data from an outside source etc. are interesting and practical database problems in general. However, they are not the topics of this course and therefore are not suitable for the class project. 3. If two teams’ projects are too similar to each other’s, they are not suitable.Originality Requirement No matter what your source is for the database, it must satisfy the originality requirement as discussed below. Each student or team is required to collect and compile their own information requirements, design the ERD, design the tables, and implement the database in ACCESS and Oracle. A project where information requirements are laid out already in writing or where the ERD is already given, or where the tables are already designed is not acceptable. When you submit a project idea for me to approve, the assumption is that the information requirements do not already exist in a document written by someone else (changing a few things here and there is not considered sufficiently different). If this is not the case, you’re required to disclose that information to me, before the project is approved. Sometimes a student may have already done (or is doing) an original project for a different course. If the project idea is original to the student, the student may use that same idea in this course with some penalty points. This is because the student is using the same work to receive credits in two different courses. If the database in the other course is not the original work of the student, for example, when the instructor of that course gives the information requirements and the ERD,
  • 42. that database can’t be used as the class project. Reverse engineering: If a student intends to design the database based on his/her interactions with a user interface, it is acceptable if 1) the student discloses that reverse engineering is used based on the available (often web-based) interface, 2) there is no written document of information requirements available to the student, and 3) there is no corresponding ERD or table design available to the student. Situations where these conditions are not satisfied are unacceptable project situations. Borrowed ideas: If a student finds project ideas from a written source, the project is acceptable if 1) the student discloses that the idea is borrowed from a written source and submits the written source with the project submission, 2) the student compiles information requirements using his/her own language and the resulting document is substantially smaller (at least a third smaller in number of words), and 3) there is no corresponding ERD or table design available to the student. Situations where these conditions are not satisfied are unacceptable project situations. Other limitations: Other situations not discussed here may or may not be acceptable. When attempting a project in non- standard situations (the standard situation is one where all elements are original and the student is starting from ground zero), it is the student’s responsibility to disclose all information known to the student concerning what’s already been done or will be done by others by the project due date about a particular application environment. 5 | Page Prj3: Project Final Requirements25 Points. Submit all documents to Canvas.Deliverables
  • 43. 1. An ACCESS database file containing all your tables and the interface. (Steps 1 & 3) 2. A Word file containing Steps 2 & 4. 3. If relevant, supporting documents for Step 4.Submission of project Submit all documents through Canvas in one group member’s Canvas account. Make sure you have attached all files before hitting the submit button. Note that multiple files can be attached, one-by-one, through the submission area. Step 1 (0 Points). If you didn’t create all tables in ACCESS in Prj3, implement all tables in ACCESS in this stage. Enter some data in each table. Define the PKs and the FKs. You may use fictitious data. For tables like Customer, Emp, and Product, enter 5 or more rows of data; for tables like Order, Purchase, Transaction, Class, enter 7 or more rows of data; For tables like TransactionDetails; OrderDetails (i.e., tables created from m-n relationships), enter 12 or more rows of data. (If you have already done this for Prj3 and submitted it for grading, there is nothing to do for Step 1.) Step 2: (5 Points): Describe the functionalities that users of this database would like implemented. This is the basis for your interface design. This is where you discuss functionalities from the user's perspective, before the interface is designed. This is not where you discuss the forms in your database. Note that all tables in your database must be used in some fashion; otherwise you’ll lose points in the Interface Design step (Step 3). Submit this in a Word document with a cover page that lists 1) name of project, course number and title, semester and year, 2) group member names. Step 3: (20 Points) Interface Design Design the ACCESS interface on top of the tables your created in Step 1 to allow users to interact with them
  • 44. (retrieve/insert/delete/update). Your interface should provide functionalities described in Step 2. Since a database allows users to retrieve, update, delete, and insert data, you may want to design your interface to provide users with easy or background retrieval/updating/deleting/inserting. For example, you may want to design some parameter queries to retrieve information. You may also allow users to perform searches. For another example, if you are designing a database for a library, the switchboard should contain a textbox or a combo box for entering a PatronId for checking out books. Upon entering the PatronId, a new row is automatically added to Table "Transaction." This new row records current date/time and PatronId. Next, there should be a textbox or combo box to entering barcode of each book checked out. Upon checking out each book, a new row is automatically added to Table "TransactionDetails" for each barcode so entered so which books the patron is taking out are recorded. Table "Book" should be updated to record that these books are checked out. Users should be able to navigate from one form to another in a logical, easy-to-use fashion. To achieve that, use various controls discussed in class such as combo boxes and command buttons. Subforms are also a very good way to allow users access multiple inter-connected tables in the database. Use Macros to automate automating routine business operations such as updating book status upon checking out as discussed above. Just build a form for each table, which would allow users to insert, delete, and update rows, would not earn you a good grade for this step. Your design of the interface should validate your data requirements stated in Prj1 (if users cannot interact with certain data, why store them?), and should correspond to required functionalities addressed in Step 2. Note: Try to use all principles discussed in the handout: e.g., 1). user combo boxes for foreign keys and other places, 2) use auto look up forms, 3) use subforms, 4), use unbound controls to solicit input for searches, 5) provide ADD, DELETE, SAVE,
  • 45. and CLOSE buttons, 6) Use Update, Insert, and Delete queries that are called by macros, 7) Use macros for automation. Step 4: State project source (see Prj0 one-page description requirements document) and Provide Supporting Documents, if applicable If your project is a real-world project, say so and provide supporting documents. Attach blank paper forms for the application environment that you are designing the database for. In your write-up, provide the actual mailing or web address of the company. You may provide other contact info as well (such as phone numbers) and any information that may substantiate your claim that it is a real-world project. If no claim is made or no supporting documents are provided, your project will be considered a made-up project. (Note, paper forms are forms people fill out using a pen, not ACCESS forms.) If you’re reverse engineering a database, say so and provide web links and supporting documents if possible.Grading of the project: The total project score is adjusted up for complex projects and for real-world projects. Late Project Policy Late project carries a penalty of 0.5 point (out of 100) every 2 hours. 2 Points maximum every 24 hours. Late projects start counting at 8:00 am the next day. (This is to say, even though the project is due at 11:59 pm the previous day, as long as you submit it by 8:00 am the next day, there is no penalty.) Late projects submitted on or after the date that grades are due from the instructor to the Registrar’s office is considered “Missed Projects.” This date is usually the Wednesday after the final’s week. Missed projects will receive 0. Exceptions may be made concerning missed projects if special situations arise. Consult the instructor as soon as possible if such situations arise. Please note that if you wait until the last couple of days to work
  • 46. on your project and something comes up (e.g., you get sick or you experience a traumatic event) causing you to miss the deadline, penalty will still be imposed. To give yourself enough time, you may want to start this stage ASAP. 2 | Page Project Stage 2: Oracle Implementation25 Points. Submit all documents to Canvas.Size of Database The ideal size of the project is about 5-7 tables. This offers enough complexity and is also manageable. More than seven tables may be too large. Oracle Account to Use and Clean Up 1. Each student has another account with the userid ORA##PRJ. The initial password is dbclass. (So you log in using ORA##PRJ as userid and dbclass as password. ## is the two digits assigned to you.) 2. You must use ORA##PRJ for this part of the project (otherwise you’ll lose points). 3. Clean up your ORA##PRJ account first by removing all tables irrelevant to your project. By the time I grade your project, your ORA##PRJ must contain only tables relevant to your project (otherwise you’ll lose points). Be sure to change your password otherwise someone else may accidentally log in to your account, remove all your tables, and put his/her tables in your account. You would lose a lot of points if that happens to you. PRJ2 Steps Step 1) (5 Points). Implement all tables in ACCESS. Enter some data in each table. Define the PKs and the FKs. You may use fictitious data. For tables like Customer, Emp, and Product, enter 5 or more rows of data; for tables like Order, Purchase, Transaction, Class, enter 7 or more rows of data; For tables like TransactionDetails, OrderDetails (i.e., tables created from m-n relationships), enter 12 or more rows of data.
  • 47. Step 2: (20 Points): Oracle SQL a). Drop all tables in your project account (ORA##PRJ) that are irrelevant to your project. Each group member must do this and is evaluated separately for a).. b). Choose 6 tables connected through PK-FK pairs (no islands) AND create those tables in each group member’s ORA##PRJ account. In a script file, create the tables, define all primary keys and foreign keys, and insert the same data that you entered in ACCESS. If a table has many rows of data, inserting up to 12 rows of data is sufficient. See cretabs.sql posted in Oracle module for example. (For example, the tables that we have been working with: Product—Item—Ord—Customer—Emp—Dept are 6 tables that are connected by PK-FK pairs as indicated by “—“. If you have 6 or fewer tables, create all your tables in Oracle.) Note, I ask you to create the tables in ACCESS first so you only need to type the actual data once. After entering the data in ACCESS, from ACCESS, you can use the “Export” function to export the data in each table to a text file. Then you can combine the text files and modify the combined text file to create the script file for Oracle. c). At the beginning of the script, add some comments (use /* */ or use --) to provide a “Cover Page.” The comments area should contain i) name of project, course number and title, semester and year, ii) all group member names, and iii) Oracle account Ids for all group members. I need your account user names but not your passwords to grade your project. d). Each group member should run the script in his/her own ORA##PRJ account and generate the same project tables. If your account does not contain your project tables, you’ll lose 12 points for Step 2. Group members are graded separately for d).
  • 48. You’ll lose points if 1) you did not indicate on your cover page your oracle account(s) used for your project, or 2) your ora##prj account has irrelevant tables. Deliverables 1. An ACCESS file containing all your tables, with the primary keys and foreign keys defined and data inserted. 2. ONE script file creating 6 of your tables, related keys, and data, with a comments area at the beginning that serves as a the “Cover Page.” Do not put the “Cover Page” on a separate file. 3. The 6 Tables with data and related keys created in your Oracle project accounts (ORA##PRJ). This is the result of Step 2. I'll check them in your Oracle project accounts using my own script. There is nothing to actually submit for this deliverable item. Run the script in each group member’ account to create the tables, define constraints, and insert data.Submission of project Submit both documents (ACCESS file and Script file) through Canvas in one group member’s Canvas account. Make sure you have attached both files before hitting the submit button. Note that multiple files can be attached, one-by-one, BEFORE clicking on the Submit button. Do not make two submissions each with a different file. When I download students’ submissions for grading, only files in the last submission will be downloaded. So if you have to make another submission before the deadline, attach both files again. Do not make submissions from two or more group members’ Canvas accounts. Submit both files from one group member’s Canvas account only. 2 | Page Project Requirements Stage 2 15 Points Step 1) (0 Points) Include your ERD with this submission. Stage 2 can’t be graded if your ERD is not included. Modify your
  • 49. ERD according to feedbacks given. If you have modified your ERD, submit the modified ERD. Step 2) (15 Points) Transform the E-R model into a relational data model. Report the following 6 steps. Follow the example seen here. a) Convert every entity into a table. Use underline(s) to identify the primary key of a table. See Example a) on the next page. b) Convert all 1-n and 1-1 relationships. Clearly indicate attributes added as a result of converting a 1-1 or a 1-n relationships. Use italic fonts for this purpose. See Example b) on the next page. c) Convert all m-n relationships. See Example b) on the next Page. d) List the final conversion result. See Example c) on the next page. Use underlines to indicate primary keys. Identify foreign keys in each table. e) After you have listed the tables based on the ERD, determine which normal form each table is in. If a table does not satisfy BCNF, either normalize it or clearly state the reasons why you choose to keep the table in a lower normal form. See Example d) on the next page. f) List the final normalized tables with primary keys and foreign keys identified. See Example e) on the next page.Example: Project ERD and the conversion process are shown on the next pages.
  • 50. a): Convert all entities and get: Vendor: (vendorId, vname, address, phone) Order: (order#, Orderdate) Product: (Stock#, price, Desc) Payment: (PaymentNo, Pdate, Amount) b): Convert all relationships · Vendor-places-Order Relationship: This is a 1-n relationship with an attribute. Add the primary key of "1" entity (Vendor) to the many side (Order) as a foreign key. Relationship attribute is added too. Get: Order: (order#, Orderdate, VendorId, OrderSource) Foreign key: VendorId · Order-Contains-Products Relationship: This is anm-n relationship with attributes, so make a new table, OrderDetails: OrderDetails: (Order#, Stock#, Quantity, Price) Foreign keys: Order#, Stock# · Payment-pays for-Order: This is a 1-1 relationship. Since each payment must have a corresponding order but each order may not have a corresponding payment yet, to advoid null values, add order# (“1” side) to Payment (pretend “many” side). Get: Payment: (PaymentNo, PDate, Amount, Order#) Foreign key: Order# c): Final Conversion Result:
  • 51. Vendor: (vendorId, vname, address, phone) Order: (order#, Orderdate, VendorId, OrderSource) Foreign key: VendorId Product: (Stock#, price, Desc) Payment: (PaymentNo, Pdate, Amount, Order#). Foreign key: Order# OrderDetails: (Order#, Stock#, Quantity, Price). Foreign keys: Order#, Stock# d): Normal Form Determinations: All Tables are in BCNF. e): Final Result after normalization Vendor: (vendorId, vname, address, phone) Order: (order#, Orderdate, VendorId, OrderSource) Foreign key: VendorId Product: (Stock#, price, Desc) Payment: (PaymentNo, PDate, Amount, Order#). Foreign key: Order# OrderDetails: (Order#, Stock#, Quantity, Price). Foreign keys: Order#, Stock# 3 | Page PaymentPaymentNoPDateOderOrder#OrdateVendorvnameaddre ssVendoridphoneProductStock#PricePaysForContainsPlaces1nm 11nDescSourceQuantityPriceAmount Payment PaymentNo PDate Oder Order# Ordate Vendor vname
  • 53. 1 1 n Desc Source Quantity Price Amount Stage 1 Project Requirements –Data Requirements and ERD 35 Total Points. Submit a hard copy before class. Step 1): (15 Points) Discuss information requirements for the database application, addressing the following points. · (0.5 point) Discuss background of the company and the industry they are in. · (0.5 point) Discuss problems with the current way of doing business or with the current system, problems with obtaining timely and accurate vital information. Your database may not be able to resolve all problems identified here. Specify the problems your database is trying to solve (i.e.; scope of your solution). · (4 points) Provide detailed descriptions of business operations that will need or generate data for which you are designing the database. The write up here serves as the natural language description of data requirements. This is not the place to describe your tables or what the attributes are for the tables. This is where you describe business processes and business rules. · (8 Points) Use the four sentence templates discussed in class to describe detailed data requirements that mostly match the data requirements descriptions in the last bullet. The sentences
  • 54. should start with “Database needs to store.” For cardinality of each relationship, start the two sentences with “each.” See the third sub-bullet below. The descriptions of data requirements should be such that another person (say, your instructor) can draw an ERD based on your descriptions. You may want to use bulleted statements to clearly state data requirements. Provide an example instance of each entity as well as for attributes of relationships. Here are some examples: · (For entities, attributes, and primary keys). Database needs to store information about each Order. For each order, database needs to store OrderId, OrderDate, and Total dollar amount. OrderId is unique to each Order. Order example: Order1234 ordered on 3/1/2015, with a dollar amount of $540. · (For relationships) Database needs to store information about what products are being ordered in each order. · (For relationship cardinalities): Each order can contain multiple products. Each product can appear in multiple orders. For example, Order1234 ordered SKU78 and SKU72; Order34 ordered SKU72 and SKU83. · (For relationship attributes): Database needs to store quantity and price of each product ordered in each order. (Or, for each product ordered in each order, database needs to store quantity and price.) For example, Order 1234 ordered Product SKU78 at $78/unit for 5 units. Order1234 also ordered SKU72 at $60/unit for 9 units. Your write-up may benefit from an iterative process whereby you compare your ERD with your write-up and revise the write- up if you find that certain information is not contained in the write-up to allow another person to derive attributes, primary keys, or cardinalities, or if you find that your ERD does not match your write up. Give examples of data elements if those elements are specific to the application environment, because
  • 55. other people (e.g., your instructor) may not know what they are (see the next requirement). · (2 points) Provide sample data for all data requirements as part of the submission. If the application environment uses any paper forms to collect data, fill out a set of forms with fictitious information as sample data and attach those forms as part of the submission. If the application environment does not use paper forms, provide screen captures or otherwise provide sample data (made up data are fine). If your project is made up, provide made up forms or data. Step 2): (20 Points) Draw an E-R diagram to document your application according to your descriptions provided in Step 1), including the mapping ratios for relationships. The ERD you draw here should match your descriptions in Step 1, Bullet 4. Clearly identify attributes of entities and relationships. Each entity must have a primary key and necessary attributes. · To save on diagramming effort, you may want to list all attributes of an entity inside the box for that entity. · For each entity, underline or otherwise indicate the primary key. · If writing out the attributes inside the box crowds the diagram, list the attributes for each entity separately, beneath the diagram if there is room, or on a separate page. · If the meaning of an attribute is not self-explanatory, add explanations. You may hand-draw your ERD, or you may use any drawing tools. There are many free online drawing tools available, for example, http://www.draw.io (use a template under Software Design). ERDplus.com is another good tool. If you’re not using Visio, Take a screenshot of your ERD and insert the screenshot as an image in your Word Document. If you’re using Visio,
  • 56. insert the ERD as an editable image. The solution file for ERD exercises posted in Canvas were drawn with Visio. You can copy one and modify it for your own ERD. It would save you some time this way. Important Drawing ERD and converting it to a list of tables is an iterative process. After drawing the ERD, it’s beneficial to convert that ERD into a list of tables and then investigate whether the final tables make sense. This often will give you feedback on your ERD. However, ERD conversion is not required in Prj1. It’ll be on Prj2 (because your ERD may change). 2