Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

10. (DDL) Solve following four questions (15 points). A. Create the vendor table

ID: 3586577 • Letter: 1

Question

10. (DDL) Solve following four questions (15 points).

A. Create the vendor table based on the following specification? COLUMN_NAME Data_TYPE Length CONSTRAINT_TYPE IS_NULLABLE VendorId number 7,0 PRIMARY KEY NO VendorName Varchar2 25 NULL YES

B. Vendor Table, add AccountNumber column of varchar2 (50) data type.

C. Vendor Table, Change vendorname column to allow for longer vendor names varchar2 (150).

D. Create a sequence that can be used with the primary key column of the vendor table. The sequence should start at 20 and have a maximum value of 6000. have your sequence increment by 1, name the sequence VENDORID_SEQ;

E. Using VENDORID_SEQ, Insert one record into the Vendor table.

F. Drop the vendor table and VENDORID_SEQ sequence

Explanation / Answer

Solution===============

a)

CREATE TABLE vendor
(
vendorid NUMBER(7, 0) NOT NULL,
vendorname VARCHAR2(25),
PRIMARY KEY (vendorid)
);

b)ALTER TABLE vendor
ADD accountnumber VARCHAR2(50);

c)ALTER TABLE vendor
MODIFY vendorname VARCHAR2(150);

d)CREATE SEQUENCE vendorid_seq
MINVALUE 20
MAXVALUE 6000
START WITH 20
INCREMENT BY 1
NOCACHE
NOCYCLE;

e)INSERT INTO vendor
VALUES (vendorid_seq.NEXTVAL,
'sunny',
12345);

f)DROP SEQUENCE vendorid_seq;
DROP TABLE vendor;

Let me know, if any doubts....