PLSQL Practical Questions
PLSQL Practical Questions
1
All Sections are mandatory. Please ensure that all your answers are clearly written. Any scripts or files
related to your work shall be saved properly and available in your main working folder.
BCM Ltd is a financial institution recently set up. While the company provides financial services and
advices, it makes use of an off-the-shelf information system to help operate its daily activities. The
system data is hosted on an Oracle database.
However, as the owner is still managing the company's internal expenses and invoices manually, he is
looking forward to move to a simple information system as a way of having a better view on his
Purchase Orders and payments to make a better follow up and to be able to undertake decisions that
are more accurate.
All information were kept in an excel sheet but have already been loaded in the existing Oracle database
in its raw format in table "XXBCM_ORDER_MGT". The first column in the table contains both the order
reference and order lines. The table contains the list of expenses managed by the owner in terms of
Purchase Orders raised as well as the respective Invoices received from his suppliers. A tracking of
payments effected per invoice is also maintained in the transactions.
You are requested to work on the analysis part based on the existing database data loaded and come up
with appropriate solutions.
1. Analyze the data and propose briefly how you would normalize the information. Outline two
reasons why this must be done. [5 marks]
2. Further to your analysis, design an Entity Relationship Diagram (ERD) based on following tables:
XXBCM_ORDER_MASTER
XXBCM_ORDER_DETAIL
XXBCM_SUPPLIER
XXBCM_INVOICE
showing clearly the relationships with comments where applicable.[8 marks]
3. Based on your ERD, provide proper Create Table scripts with necessary columns, data types and
constraints. Create your tables in the database with appropriate naming convention. [8 marks]
4. Develop a PLSQL procedure to trigger a migration process that will extract information from table
"XXBCM_ORDER_MGT" and load them in tables that you created with proper data format. You are
expected to create a database package with appropriate functions or procedures. All the database
objects that you need to create shall be available on your working database environment and
properly compiled. [35 marks]
5. Outline in bullet points how you would ensure that all data have been processed and how you
would handle exceptions and errors. [4 marks]
2
Section 3: SQL Practical Questions
This section consists of SQL statements which you are expected to derive to return expected results
from the records in tables you created in section 2.
1. The owner wishes to have a report displaying a summary of Orders with their corresponding list of
distinct invoices and their total amount to be able to reconcile his orders and payments. The report
shall contain the details as per table below ordered by latest Order Date on top. [8 marks]
2. Return details for the THIRD (3rd) highest Order Total Amount from the list. Only one record is
expected with the following information. [8 marks]
3. List all suppliers with their respective number of orders and total amount ordered from them
between the period of 01 January 2017 and 31 August 2017. Output details as per below. [4 marks]