0% found this document useful (0 votes)
38 views

ADS - Data Storage Tutorial 1: Instructions

The document provides instructions for creating a database and tables to store grant recipient and grant data for the South African Post Office. It includes: 1. Creating a "SASSA_Grants" database and deleting it if it already exists. 2. Creating three tables - "GrantRecipients", "GrantNames", and "RecipientGrantLinks" - with specified fields to store recipient, grant, and link data. 3. Creating a SQL script to return all grant recipients with the grants and amounts they receive, including a total amount if they receive multiple grants. 4. Creating a view called "GrantTotals" that shows each grant and the total number of recipients for that grant.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

ADS - Data Storage Tutorial 1: Instructions

The document provides instructions for creating a database and tables to store grant recipient and grant data for the South African Post Office. It includes: 1. Creating a "SASSA_Grants" database and deleting it if it already exists. 2. Creating three tables - "GrantRecipients", "GrantNames", and "RecipientGrantLinks" - with specified fields to store recipient, grant, and link data. 3. Creating a SQL script to return all grant recipients with the grants and amounts they receive, including a total amount if they receive multiple grants. 4. Creating a view called "GrantTotals" that shows each grant and the total number of recipients for that grant.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ADS - Data Storage Tutorial 1

Instructions

• For all these you’re required to use MySQL and MySQL workbench platform.
• After completion you will be required to upload your work into the link that will be provided
later on either blackboard or Google forms
• You are expected to work independently for these tasks, yes you may consult the internet or
any books for research purposes.

Background to the Task.

You have been appointed as an IT developer by the South African Post Office to assist them as they
have been appointed by SASSA to distribute the grants. The following has to be achieved.

1. Using MySQL and MySQL workbench as stipulated in the instruction, write a database sql
script that will create new database call “SASSA_Grants” and if it already exist it must be
deleted first.
2. Using the “SASSA_Grants” database: create scripts to achieve the following:
a. Create a table called “GrantRecipients” with the following fields:
RecipientID Surname FirstNames IDNO Address
(Integer, Auto (varchar max (Varchar max (integer, Max (varchar max
increment, 50) 50) 13) 80)
Primary Key)

b. Create a table called “GrantNames” with the following fields:


GrantID (Integer, Auto GrantName (varchar max GrantAmount
Increment, Primary Key) 50) (Money/number)

c. Insert the following data into the table “GrantNames”


1 Pension Grant R1500
2 Child Grant R450
3 Unemployment Grant R350
4 Health Support R1500

Page 1 of 2
d. Insert any data into the table “GrantReceipients” that meets the fields criteria, using
the MySQL workbench interface, you might have to research how to commit data
here or use a script as well.
e. Using the script or MySQL workbench interface create a table called
“RecipientGrantLinks” with the following fields:

RecipientLinkID (Integer, RecipientID (Integer) GrantID (Integer)


Auto Increment, Primary
Key)

This table holds the link that identifies which Recipient collects what type of a grant.

f. Load the “RecipientGrantLinks” table with the sample data of your choice as long as
the data exists in both “GrantNames” and “GrantRecipients” tables so that the links
will be meaningful.
3. Create a SQL script that will return all GrantRecipients and the grants they collect ensure the
grant amount is shown as well, If the Recipient receives more then 1 grant i.e. child grants
and Pension, a total amount that they receive must also reflect, also it must be indicated
whether the Recipient is Male or Female and how old they are.
4. Finally create a View called “GrantTotals” this must show each grant and a total of
Recipients for it like in the following table as an example:
GrantID GrantName Total Recipients
1 Pension Grant 25
2 Child Grant 50

Page 2 of 2

You might also like