Final Project Oracle PDF
Final Project Oracle PDF
Final Project
The final project as a criterion for accreditation of the subject 'Databases' consists of the
planning, design, creation, and administration of a company's Database that solves
a real world need. It must consist of the following points:
INSERT queries to populate the tables with data (Minimum of 5 rows per table)
3 SELECT queries with ORDER BY clause
3 SELECT queries with logical conditions (AND, OR, NOT)
1 query SELECT with use of:
Arithmetic operators
Concatenation operators
Search conditions
The use of the BETWEEN clause
The use of NOT condition
Alias for the columns
SQL query to create an ANONYMOUS BLOCK that prints all the data from a table
using a CURSOR and a LOOP
SQL queries for the creation of a STORED PROCEDURE that takes 1
input parameter
SQL queries for creating a STORED PROCEDURE that takes 1
input parameter and 1 output parameter
SQL queries for creating a STORED PROCEDURE that takes 1
input and output parameter.
SQL queries for the creation of 3 FUNCTIONS
SQL queries for the creation of 3 TRIGGERS
Personal conclusions about the project
NOTE: All SELECT queries and PL/SQL code must be accompanied by a descriptive text.
Please detail its functionality, as well as a screenshot of the result.
ANNEX 1: EXAMPLES OF BUSINESS MODELS
EXAMPLE 1
A company sells products to various customers. It is necessary to know the personal data.
of the clients (Name, surname, RFC, address, and date of birth). Each product
It has a name, a barcode, as well as a unit price. A customer can
buy several products from the company, and the products can be purchased by several
clients.
The products are supplied by different suppliers. It must be taken into account.
that a product can only be supplied by one supplier, and that a supplier
can supply several different products. From each supplier, we want to know their
RFC, name and address.
EXAMPLE 2
From the populations that receive the packages, it is important to keep the population code.
and the name. A package can only arrive at one population. However, to one population
Several packages may arrive.
From the trucks that the truck drivers carry, it is important to know the license plate, the model, the
type and power. A truck driver can drive different trucks on different dates,
and a truck can be driven by several truck drivers.
EXAMPLE 3
For each car, it is necessary to know the license plate, brand, model, color, and selling price.
The cars sold by the dealership can be new or used. From the cars
new interests to know the number of units in the parking lot. Of the
used cars are interested in the number of kilometers they have traveled.
The dealership also has a workshop where the mechanics repair the cars.
that customers bring in. A mechanic repairs several cars throughout the day, and a car
it can be repaired by various mechanics. The mechanics have an ID, first name, last name,
hiring date and salary. It is also desired to store the date when it is repaired.
each vehicle and the number of hours it took to make the repair of each car.
EXAMPLE 4
The TEC100 clinic needs to maintain a computerized control of its patient management and
doctors.
For each patient, it is desired to store their identifier, name, surname, address,
population, province, postal code, phone number, and date of birth.
For each doctor, it is desired to store their key, name, surname, phone number, and specialty.
It is desired to keep track of each of the income that the patient makes in the hospital.
Every admission that the patient makes is recorded in the database. From each admission
the entry code, room number, bed number, and date are stored in the
that the patient makes the admission.
A patient can have multiple admissions to the hospital. A doctor can attend to several.
incomes, but a patient's admission can only be handled by a single doctor.
EXAMPLE 5
In the central library, author and book cards are managed. In each author's card
the author code and their name are available. For each book, the code, title, and ISBN are stored.
editorial and number of pages. An author can write several books, and a book is written
by an author. A book is made up of copies. Each copy has a code and a
Localization. A book has many copies and each copy belongs to only one book.
The users of the central library also have cards, and they check out copies of
the library. For each user, the code, name, address, and phone number are saved.
copies are loaned to the users. A user can borrow several
copies, and the copies can be loaned to several users. From each loan
it is important to save the loan date and the return date.
EXAMPLE 6
The professional football league has decided to computerize its facilities by creating a database.
data to store the information of the matches played in the league.
First of all, it is desired to store the players' data. From each player, we want...
store the name, date of birth and position played (goalkeeper, defender,
midfielder...). Each player has a player code that uniquely identifies them.
unique.
For each of the teams in the league, it is necessary to register the team name,
of the stadium where they play, the year the team was founded, and the city of origin. Each
the team also has a code that identifies it uniquely. A player can only
belong to a single team.
For each match that the league teams play, the date on which it takes place must be recorded.
play the match, the goals scored by the home team and the goals scored by the
visiting team. Each match will have a numerical code to identify it.
branch
branchId NUMBER(6) product
branchName VARCHAR2(50) (PK)ProductID NUMBER(6)
address VARCHAR2(100) VARCHAR2(20)
municipality VARCHAR2(50) price NUMBER(7, 2)
postalCode NUMBER(5) (FK)branchId NUMBER(6)
(FK)ProviderID NUMBER(6)
(FK)idCategory NUMBER(6)
provider
(PK) SupplierID NUMBER(6)
SupplierName
telephone VARCHAR2(20)
category
idCategory NUMBER(6)
categoryName VARCHAR2(20)