Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

- - Create the Stock table CREATE TABLE Stock ( Stock _ ID NUMBER PRIMARY KEY, Stock _ Type VARCHAR 2 ( 5 0 )

-- Create the Stock table
CREATE TABLE Stock (
Stock_ID NUMBER PRIMARY KEY,
Stock_Type VARCHAR2(50) NOT NULL,
Stock_Model VARCHAR2(50) NOT NULL,
Manufacturer VARCHAR2(50) NOT NULL
);
-- Create the Customer table
CREATE TABLE Customer (
Cust_ID VARCHAR2(10) PRIMARY KEY,
Cust_FName VARCHAR2(50) NOT NULL,
Cust_SName VARCHAR2(50) NOT NULL,
Cust_Address VARCHAR2(100) NOT NULL,
Cust_Contact VARCHAR2(20) NOT NULL
);
-- Create the Repairs table
CREATE TABLE Repairs (
Repair_ID NUMBER PRIMARY KEY,
Repair_Work VARCHAR2(100) NOT NULL,
Repair_Date DATE NOT NULL,
Repair_Hours NUMBER NOT NULL
);
-- Create the Sales table
CREATE TABLE Sales (
Sales_Num NUMBER PRIMARY KEY,
Sales_Date DATE NOT NULL,
Sales_Amt NUMBER NOT NULL,
Stock_ID NUMBER,
Cust_ID VARCHAR2(10),
Repair_ID NUMBER,
FOREIGN KEY (Stock_ID) REFERENCES Stock(Stock_ID),
FOREIGN KEY (Cust_ID) REFERENCES Customer(Cust_ID),
FOREIGN KEY (Repair_ID) REFERENCES Repairs(Repair_ID)
);
Question
(15 Marks)
TASK: Create Function
Create a function called fn_IT_Gear that would be meaningful and relevant for this
database. Your function should accept at least 1 input parameter and display at least 4
relevant pieces of information.
In your solution,
display the data and provide the code to execute the function.
use relevant exception handling and
provide relevant code comments .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions