Databased Programming with SQL (On Oracle) - Formative Assessment 1_q82
Databased Programming with SQL (On Oracle) - Formative Assessment 1_q82
Learning Objective:
Formative assessment 1 will cover the following concepts:
a. Database creation
b. Basic retrieval
c. Filtering and Sortings
d. Aggregate Functions
e. Joins
f. Subqueries
g. Data Manipulation
h. Views
i. Constraints and Indexes
Attributes/Competencies Assessed:
N/A
Scope:
The scope of this formative assessment is based on a solid knwoledge coding databases
using T_SQL.
Technical Aspects:
The number of pages for this formative assessment is 13 and the following font and size
should be used in your report:
a. Font: Arial
b. Size: 12 and 14 for headings
c. Font colour: Black
Save and upload the report as a .PDF (No backgrounds) with the following naming
convention:
a. Student no_StudentName_StudentSurname_ModuleCode_FA1 (No ZIP folder
uploads)
Ensure adequate referencing is used when using information from either books or
internet. Plagiarism is a serious offecne and can result in 0% for the assessment when
excessive work is copied without proper referencing.
Please complete the following and sign as requested for Portfolio of Evidence (POE)
a. Save code with screeshots of each question and upload when completed
b. Pre-Assessment agreement (Save, sign and submit as PDF)
c. Assessment Feedback Agreement (Save, sign and submit as PDF)
Mark allocation for report
See Mark allocation sheet below
Scenario
Tygervalley Pet Shelter (TPS) receives food donations from a group of pet food
manufacturers.
TPS relies on each manufacturing company for a particular need. For example,
Veggie Land
supplies all the vegetables and Premier Seed Suppliers supplies all the seeds.
The different food types are allocated to the animals according to their category.
For example,
food type ‘seeds’ is allocated to category ‘Birds’, while food type ’vegetables’ is
allocated to the
categories ‘Mammals’ and ‘Birds’.
Each animal category is subdivided into different pet types. For example, the
mammal record
could relate to pet types ‘Dog’ and ‘Cat’.
TPS has recruited you to be their database designer. The database will store
information on their
suppliers, food types, animal categories, and pet types.
Record a unique, auto-incrementing ID, company name, contact number,
and possibly an email address for each manufacturer.
When recording information about the different food types, ensure that the
expiry date is also stored.
When recording how much food will be allocated per animal category,
specify the quantity amount as two separate fields. For example, if 8.5
kilograms of Roast Chicken Pellets are allocated to category ‘Mammals’,
‘8.5’ and ’kg’ will be two different fields.
The stock level for each pet type must also be stored together with the pet
type so that the number is known for each category. For example, there are
10 dogs and 20 cats for category ‘Mammals’, or 40 parrots for category
‘Birds’.
Instructions
Use Oracle SQL syntax for all the instructions presented in the following
questions.
Execute each query and verify the results to ensure accuracy.
Feel free to use any necessary SQL clauses, functions, and statements.
Document your queries and the corresponding results. (Screenshots)
Question 1
(30)
Create the following:
a) Fully functional database with an appropriate name for your database (10)
Linked Server created to connect from SSMS to Oracle:
Database:
b) Create all tables according to the ER diagram supplied
(10)
c) Create at least ten (10) entries/inserts for all your tables created
(10)
Script Continues below
(120)
a) Question 2 Basic retrieval
(15)
a. Write an SQL query to retrieve the Food name and Food expiry Date from the
“FoodType” table.
b) Filtering and sorting
(15)
a. Retrieve the “FoodID”, “FoodName”, “FoodExpiryDate”, “FoodDescription” and
“Measurement” from the “FoodType” table where the “Measurement” is
greater than 10kg. Sort the results by “Measurement” in descending order.
c) Aggregate Functions
(15)
a. Calculate and display the “AllocatedAmount” of “FoodType” and the average
“AllocatedAmount” per “FoodType”.
d) Joins (15)
a. Retrieve the “FoodID”, “FoodName”, “Measurement”, “CompanyName,
“ContactNumber’, and “AnimalType” for all “FoodTypes” who have a
“Measurement” value of 5kg or above.
b. Joins to be used to link all the entities in the ER diagram.
e) Subqueries (15)
a. Find the Company with the highest total amount of “FoodTypes” supplied.
Display the “CompanyName”, “ContactNumber” and “Email”. Utilize a
subquery to achieve this.
f) Data Manipulation
(15)
a. Increase the “Measurement” of the “FoodType” with ProductID 3 by 50kg.
g) Views
(15)
a. Create the following views:
i. vw_ManufacturerDetails
Select manufacturing company details, the food type, food ID, and
amount per category
.
ii. vw_PetsPerType – Select each animal type, total animals in stock, the
animal category ID, and category name.
iii. vw_ExpiredFoodDetails – Select the company name, contact number,
food ID, name, expiry date, amount per category, measurement, and the
category name. This only applies to expired products that are in use
(have dependent records). HINT: Use the GETDATE() function to compare
the expiry date against today’s date.
iv. vw_LowestFoods – Select the category name and the sum of the total
animals in the category. Only the three records with the lowest pets
must be selected.
h) Constraints and Indexes
(15)
a. Add a unique constraint to the “Email” attribute in the “FoodManufacturer”
table to ensure that each email is unique.
Mark allocation for student
Question 1.a 10
Question 1.b 10
Question 1.c 10
Question 2.a 15
Question 2.b 15
1Body of the
Question 2.c 15
report
Question 2.d 15
Question 2.e 15
Question 2.f 15
Question 2.g 15
Question 2.h 15
1 day late
-5
2 days late
Deductions -10
3 days late
-15
Total: 150
ASSESSMENT AGREEMENT
Assessment Preparation: Preparing the Candidate
Student name Date 24 Nov 24
and surname Mogamat Adams
Time 22:25
Assessor name
Venue Cape Town
and surname
How to prepare the Document Agre Action
candidate Requirements e Required
(tick)
Explain to the candidate Assessment Policy
why you are meeting Assessment process X
and the purpose of the
assessment.
Discuss the assessment Assessment strategy
X
plan in detail.
Explain assessment Assessment
process, show instruments
assessment instruments
X
to candidate and
describe assessment
conditions.
Identify the role-players Assessors
during assessment. X
Moderator
Describe the evidence Examples of evidence
required to be declared X
competent.
Explain how evidence Mark allocation
X
will be judged. explained
Explain to the candidate Assessment task
how to prepare: Give description
X
candidate assessment
task description.
Confirm with the Detailed briefing on
candidate what he/she exact requirements to
X
should bring to the be given to candidate
assessment. in writing
Ensure that candidate Appeals Policy
understands the Appeals procedure
procedures of all
assessment practices. Assessment Policy
Assessment Procedure
X
Moderation Policy
Moderation procedure
Verification Policy
Verification Procedure
Ask the candidate if List needs
he/she foresees any
X
problems or identify any
special needs.
Assessment Process
Evaluation of POE addressing Essential
Embedded Knowledge in unit standards.
Evaluation of Research Projects and other
evidence addressing specific unit standards.
Consultation: assessment plan and assessment
activities and instruments. Pre-assessment
moderation and interviews conducted at this
stage.
Observation: feedback on assessment against
specific outcomes, critical outcomes in unit
standards.
Feedback: to candidate regarding sufficiency of
evidence and possible interview to gain
supplementary evidence.
Feedback to candidate regarding assessment
findings as well as review process.
Feedback Written feedback to be given to all stakeholders at the
end of the assessment process, as well as verbal
feedback to the candidate during assessment activities.
Recording Process and findings to be recorded and submitted for
Process record keeping purposes as well as moderation and
verification.
Review The review process is the responsibility of the assessor
Process and the candidate. Joint reviewing will take place after
feedback has been given to the candidate.
Right to The candidate must be advised of the right to appeal.
appeal
Resources Assignments
Required POE
Assessments
Guides
I confirm that:
I have been consulted on and have agreed to the training and
assessment process as detailed in the assessment guide.
I have been advised of my right to appeal against any assessment that
is unfair, unreliable, invalid or impracticable.
I have read and understood the appeal procedure.
I know that assessments may be moderated or verified by an external
party.
The purpose of the assessment has been clearly explained to me.
The criteria have been discussed with me, and I know I will be assessed
against these criteria.
I know when and where I will be assessed, and I was given fair notice.
I know how the assessment will be done, and any other requirements
related to the assessment.
Assessor’s
Date:
Signature
Moderator’s
Date:
Signature
Qualification SAQA
Number:
Unit standard
Number(s)
Question 1
Question 2
Lecturer Signature:
Assessor Signature:
Moderator Signature:
Note to learner
Review the feedback provided by your lecturer to check that you have been
found competent in this assessment. If there are any areas where you have
been found not yet competent, you must redo those parts of the assessment
and resubmit within the stipulated time frame.
The section below will only be completed in cases where the learner was asked
to
resubmit parts of the assessment where they were found not yet competent.
Learner Signature:
Lecturer Signature:
Assessor Signature:
Moderator Signature: