Question

From this logical model the following relational model has been created: CUSTOMER P customer_id NUMBER (5) customer_gname VAR

For the following tasks, your SQL must correctly manage transactions and use sequences to generate new primary keys for numeric primary key values (under no circumstances may a new primary key value be hardcoded as a number or value)

(i) Create sequences which will allow entry of data into the AW_STATUS, AW_DISPLAY and SALE tables - the sequences must begin at 300 and go up in steps of 1 (i.e., the first value is 300, the next 301, etc.)

(ii) Suppose it is now 10 AM on 22nd October 2020 and an artwork called “Saint Catherine of Siena'' has just been received by the MAU central warehouse from the artist with artist code 17. The minimum payment this artist is prepared to accept for this artwork is $500,000. Take the necessary steps in the database to record the required entries for this new arrival.

(iii) Using the timing as indicated, take the necessary steps in the database to record the following activities. You may assume that no other artworks have been added by this artist (artist code 17).

a) On the same day at 11 AM, this new arrival is sent from the MAU warehouse to Karma Art gallery (Ph:0413432569).

b) It is received by the gallery 3 hours and 15 minutes after leaving the MAU warehouse. MAU is immediately informed of the safe arrival of this extremely precious artwork through a telephone call.

c) On the next day the gallery places the artwork on display for a total of 10 days.

(iv) It is now 2:30 PM on the 5th day since this artwork has been displayed. No other artwork has been put on display after this artwork was displayed in any gallery (ie. it is the most recent display). It is now sold to a customer (customer id 1) for $850,000. Take the necessary steps in the database to record the required activities.

Please help me with this tasks.

Thank you in advance:)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

(i) CREATE SEQUENCE SQ1 START WITH 300 INCREMENT BY 1;

INSERT INTO AW-STATUS(aws_id) VALUES(SQ1.nextval);

INSERT INTO AW-DISPLAY(aw_display_id) VALUES(SQ1.nextval);

INSERT INTO SALE(sale_id) VALUES(SQ1.nextval);

(ii) CREATE SEQUENCE SQ2 START WITH 500000;

ALTER TABLE AW_STATUS ADD PRIMARY KEY(artist_code);

INSERT INTO ARTWORK VALUES(17,001,“Saint Catherine of Siena'',SQ2.nextval,"2020-10-22 10:00:00");

INSERT INTO AW_STATUS VALUES(300,17,001,"2020-10-22 10:00:00","Y",111);

(iii) (a) INSERT INTO AW_STATUS VALUES(SQ1.nextval,17,001,"2020-10-22 11:00:00","N",111);

(b) UPDATE AW_STATUS SET set aws_date_time="2020-10-22 14:15:00",aws_action="Y" where gallery_id=111;

(c) INSERT INTO AW_DISPLAY VALUES(300,17,001,"2020-10-23", "2020-11-01",111);

(iv) INSERT INTO SALE VALUES(SQ1.nextval,"2020-10-27",850000 ,1,300);

Add a comment
Know the answer?
Add Answer to:
For the following tasks, your SQL must correctly manage transactions and use sequences to generate new...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT