100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
INF3707 ASSIGNMENT 03 ANSWERS 2023 $4.90   Add to cart

Exam (elaborations)

INF3707 ASSIGNMENT 03 ANSWERS 2023

 124 views  9 purchases
  • Course
  • Institution
  • Book

The above document contains answers (full) for the recent assignment 03 of 2023, with explanations of the code, etc.

Last document update: 1 year ago

Preview 3 out of 34  pages

  • July 21, 2023
  • July 29, 2023
  • 34
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
avatar-seller
ASSIGNMENT 03 2023 ANSWERS
Note code answers highlighted in yellow
INF3707



Question 1

1.1 CREATE SEQUENCE MY_FIRST_SEQ

START WITH 5

INCREMENT BY -3

MINVALUE 0

MAXVALUE 5

NOCYCLE;

PIC OF CODE




Explanation:

1. CREATE SEQUENCE: This SQL statement is used to create a new sequence.
2. MY_FIRST_SEQ: This is the name given to the sequence.
3. START WITH 5: It sets the initial value of the sequence to 5.
4. INCREMENT BY -3: The sequence increments or, in this case, decrements by -3 for
each new value generated.

, 5. MINVALUE 0: This sets the lower bound for the sequence, ensuring it never goes
below 0.
6. MAXVALUE 5: This sets the upper bound for the sequence, ensuring it does not
exceed 5.
7. NOCYCLE: This option prevents the sequence from cycling, meaning it will stop
once it reaches the maximum or minimum value and not wrap around to the
start value.

With these settings, the sequence will generate the following values: 5, 2, -1, 0. Since
the minimum value is set to 0 and the sequence does not cycle, it will stop at 0 and
not continue further.


1.2

SELECT my_first_seq.NEXTVAL

FROM DUAL;




Explanation: Caused by the sequence running out of values to issue, as the minimum value of 0 was
reached and the CYCLE option is set to NOCYCLE.

1.3

Error details :
-DDL statement for ord_items table will check the expiry_date with the sysdate
-Each time system date will change and hence which will not validate
-Instead add a column with todays_date date default sysdate which will add the todays date
into the column and then this date is checked with expiry_date

Sequence :

, Create Sequence ord_seq
Increment by 10
Start with 120
MaxValue 9999
nocycle;


Table Name : ord_items
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),
todays_date date default sysdate,
expiry_date date ,
constraint its_pky primary key
(ord_no,Item_no),
constraint ord_fky foreign key (ord_no) references orders(order#),
constraint check_expiry check(expiry_date> todays_date));

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 JayJo. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

83662 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
$4.90  9x  sold
  • (0)
  Add to cart