100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
INF3707 ASSIGNMENT 3 2023 Database Design and Implementation $5.84   Add to cart

Other

INF3707 ASSIGNMENT 3 2023 Database Design and Implementation

 28 views  0 purchase
  • Course
  • Institution

INF3707 ASSIGNMENT 3 2023 Database Design and Implementation

Preview 2 out of 10  pages

  • August 8, 2023
  • 10
  • 2023/2024
  • Other
  • Unknown
avatar-seller
QUESTION 1

1.1 The sequence MY_FIRST_SEQ can be created by using the following code:



CREATE SEQUENCE MY_FIRST_SEQ

START WITH 5

INCREMENT BY -3

MINVALUE 0

NOCYCLE;



1.2 The SELECT statement to display NEXTVAL for MY_FIRST_SEQ three times can be issued as
follows:



SELECT MY_FIRST_SEQ.NEXTVAL FROM dual;

SELECT MY_FIRST_SEQ.NEXTVAL FROM dual;

, SELECT MY_FIRST_SEQ.NEXTVAL FROM dual;



The error on the third SELECT statement is caused by reaching the maximum value defined for the
sequence. Since the sequence has a maximum value of 0, it cannot generate a value greater than 0.



1.3 The failure to create the table ord_items is caused by referencing a non-existent table "orders" in
the FOREIGN KEY constraint. The corrected CREATE TABLE code is as follows:



CREATE SEQUENCE ord_seq

INCREMENT BY 10

START WITH 120

MAXVALUE 9999

NOCYCLE;



CREATE TABLE ord_items

(ord_no NUMBER (4) DEFAULT ord_seq.NEXTVAL NOT NULL,

item_no NUMBER(3),

qty NUMBER(3) CHECK (qty BETWEEN 100 AND 200),

expiry_date date CHECK (expiry_date > SYSDATE),

CONSTRAINT its_pky PRIMARY KEY (ord_no, item_no),

CONSTRAINT ord_fky FOREIGN KEY(ord_no) REFERENCES ord_items(ord_no)

);



QUESTION 2

.1 To create the user Peter with a password that expires and assign the role of salesperson, use the
following code:



CREATE USER Peter IDENTIFIED BY [password] PASSWORD EXPIRE;



GRANT salesperson TO Peter;

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller GoldenKey. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $5.84. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

83225 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$5.84
  • (0)
  Add to cart