Create an Oracle sequence to generate values for volunteer numbers. The sequence should startwith 9000 and increment by 10. Do not cache any values.
PLZ help with the following question
USE ORACLE SQL or SQL LIVE
-
Create an Oracle sequence to generate values for volunteer numbers. The sequence should startwith 9000 and increment by 10. Do not cache any values.
The databse:
CREATE TABLE Packinglist(
List_ID INT NOT NULL,
Name VARCHAR(50),
Description VARCHAR(100),
PRIMARY KEY(List_ID));
CREATE TABLE Task(
Task_Code INT NOT NULL,
List_ID INT,
Task_Description VARCHAR(100),
Type VARCHAR(30),
Status VARCHAR(20),
PRIMARY KEY(Task_Code),
FOREIGN KEY(List_ID) REFERENCES Packinglist(List_ID));
CREATE TABLE Volunteer(
Vol_ID INT NOT NULL,
Name VARCHAR(50),
Telephone NUMBER,
Address VARCHAR(100),
PRIMARY KEY(Vol_ID));
CREATE TABLE Assignment(
Vol_ID INT,
Task_Code INT,
Start_Time TIME,
End_Time TIME,
PRIMARY KEY(Vol_ID, Task_Code),
FOREIGN KEY(Vol_ID) REFERENCES Volunteer(Vol_ID),
FOREIGN KEY(Task_Code) REFERENCES Task(Task_Code));
CREATE TABLE Package(
Pack_ID INT NOT NULL,
Task_Code INT,
Date DATE,
Weight FLOAT,
PRIMARY KEY(Pack_ID),
FOREIGN KEY(Task_Code) REFERENCES Task(Task_Code));
CREATE TABLE Item(
Item_ID INT NOT NULL,
Description VARCHAR(100),
Value DECIMAL(10,2),
Quantity NUMBER,
PRIMARY KEY(Item_ID));
CREATE TABLE Content(
Pack_ID INT,
Item_ID INT,
Quantity NUMBER,
PRIMARY KEY(Pack_ID, Item_ID),
FOREIGN KEY(Pack_ID) REFERENCES Package(Pack_ID),
FOREIGN KEY(Item_ID) REFERENCES Item(Item_ID));
INSERT INTO Packinglist
VALUES(101, "Packinglist1", "Packinglist1 Description"),
(102, "Packinglist2", "Packinglist2 Description"),
(103, "Packinglist3", "Packinglist3 Description"),
(104, "Packinglist4", "Packinglist4 Description"),
(105, "Packinglist5", "Packinglist5 Description");
INSERT INTO Task
VALUES(201, 101, "Task1 Description", "Type1", "Active"),
(202, 101, "Task2 Description", "Type3", "InActive"),
(203, 102, "Task3 Description", "Type2", "Progress"),
(204, 104, "Task4 Description", "Type1", "Active"),
(205, 102, "Task5 Description", "Type2", "Hold");
INSERT INTO Volunteer
VALUES(301, "Volunteer1", 1234, "Volunteer1 Address"),
(302, "Volunteer2", 2345, "Volunteer2 Address"),
(303, "Volunteer3", 3456, "Volunteer3 Address"),
(304, "Volunteer4", 4567, "Volunteer4 Address"),
(305, "Volunteer5", 5678, "Volunteer5 Address");
INSERT INTO Assignment
VALUES(301, 202, "2:40", "5:55"),
(301, 203, "3:45", "4:30"),
(304, 205, "2:40", "5:55"),
(303, 201, "9:30", "10:30"),
(302, 202, "6:40", "7:25");
INSERT INTO Package
VALUES(401, 202, "21-03-2020", "5"),
(402, 201, "20-04-2020", "1"),
(403, 202, "15-02-2021", "4"),
(404, 203, "11-08-2021", "9"),
(405, 201, "21-11-2020", "3");
INSERT INTO Item
VALUES(501, "Item1 Description", "200", 5),
(502, "Item2 Description", "150", 2),
(503, "Item3 Description", "200", 3),
(504, "Item4 Description", "290", 5),
(505, "Item5 Description", "440", 9);
INSERT INTO Content
VALUES(401, 505, 2),
(401, 504, 4),
(402, 501, 6),
(401, 501, 7),
(403, 503, 9);
Step by step
Solved in 2 steps with 1 images