You are on page 1of 6

TASK 1

SECTION A:
Entities:
1) Member
2) Food Journal
3) Food Journal Type
4) Journal Review
5) Nutrition Report
6) Foods
7) Food_category
8) Exercise

Functional Dependency:
Member ID First Name, Last Name, Date of birth, Gender, Address, Email Address, Phone
Number, Weight, Height (Partial Dependency)
Journal_ID food_ID, Serving Size, Calories/Serving, Number of Serving, Total Calories,
Date Member_ID, Type_ID (Partial Dependency)
Type_ID Description (Partial Dependency)
Trainer_ID, Journal_ID Comment, Report_ID (Partial dependency)
Report_ID Carbs, Calories, Protein, Cholesterol, Sodium, Sugars, Journal_ID (Partial
Dependency)

Relationship:
MEMBER Registers at HELPFIT by providing personal details such as Name, date of birth,
gender, address, phone number, weight and height. Which is then Stored into the HELPFIT
Database
Each MEMBER is required to fill FOOD JOURNAL recording their daily consumption of
FOODs and their FOOD CATEGORY.
The FOOD JOURNAL is then Complied into NUTRITION REPORT that is handed over to
the TRAINER to assess and give feedback to the MEMBER to Attain their personal Fitness
Goals.
Based on the Feedback from the TRAINER the MEMBER can start Fitness Plan which
includes Diet from FOODS and EXERCISES.
Cardinalities and Participation:
Mandatory:
1 member must have 1 and only 1 Food Journal, 1 food journal can only be written by 1 and
only 1 member.
1 Food Journal can have 1 or many foods, 1 food can be in 1 or many food Journals
1 Food can be in 1 and only 1 Food Category, 1 Food Category can include 1 or many Foods.
1 Food Journal can have 1 or many Food Journal Type, 1 Food Journal Type can be in 1 or
many Food Journal.
1 Food Journal converted into 1 and only 1 Nutritional Report, 1 Nutritional Report have 1
and only 1 Food Journal.
1 Nutritional Report provides 1 and only 1 Journal Review, 1 Journal Review will have 1 and
only 1 Nutritional Report.

Optional:
1 trainer can review 0 to many Food Journal, 1 food Journal can be view by 1 and only 1
trainer
Journal Review can be reviewed by 1 and only 1 trainer, 1 trainer can review 0 to many
Journal Review

TASK 3
RDM:

Members (Member_ID, First Name, Last Name, Date of birth, Gender, Address, Email
Address, Phone, Weight, Height)
PRIMARY KEY: Member_ID

Food Journal (Journal_ID, Food_ID, Serving Size, Calories/Serving, Number of Servings,


Total Calories, Member ID, Date, Type_ID)
PRIMARY KEY: Journal_ID
FOREIGN KEY: Type_ID Reference Food_Journal_Type( Type_ID)
Food_ID Reference Foods( Food_ID)
Member_ID Reference Members( Member_ID)
Food_Journal_Type( Type_ID, Description)
PRIMARY KEY: Type_ID

Nutrition Report (Report_ID, Carbs, Calories, Protein, Cholesterol, Sodium, Sugars,


Journal_ID)
PRIMARY KEY: Report_ID
FOREIGN KEY: Journal_ID Reference Food Journal (Journal_ID)

Journal Review (Trainer_ID, Journal_ID, Comment, Report_ID)


PRIMARY KEY: Trainer_ID, Journal_ID
FOREIGN KEY: Trainer_ID Reference Trainer( Trainer_ID)
Journal_ID Reference Food Journal (Journal_ID)
Report_ID Reference Nutrition Report (Report_ID)

Foods (food_ID, food_name, food_serving, food_calories, food_carbs, food_lipid,


food_sodium, food_cholesterol, food_protein, food_sugars, food_category)
PRIMARY KEY: food_ID

FOREIGN KEY: food_category REFERENCES food_category (category_ID)


Food_Category (category_ID, category_name)
PRIMARY KEY: category_ID FOREIGN KEY:

Exercises (exercise_ID, exercise, cbh)


PRIMARY KEY: exercise_ID
TASK 4

TABLE COLUMN DATA TYPE NOTES


MEMBERS MEMBER_ID VARCHAR PRIMARY
(20) KEY NOT
NULL
FIRST_NAME VARCHAR NOT NULL
(30)
LAST_NAME VARCHAR NOT NULL
(30)
DATE_OF_BIRTH DATE (DD- NOT NULL
MON-YYYY)
GENDER VARCHAR NOT NULL
(10)
ADDRESS VARCHAR
(50)
EMAIL_ADDRESS VARCHAR
(25)
PHONE INT (15) NOT NULL
WEIGHT DECIMAL NOT NULL
(5,2)
HEIGHT DECIMAL NOT NULL
(5,2)
FOOD_JOURNAL JOURNAL_ID INT (20) PRIMARY
KEY
NOT NULL
FOOD_ID INT (20) FOREIGN
KEY
NOT NULL
SERVING_SIZE VARCHAR NOT NULL
(15)
CALORIES/SERVING INT (10) NOT NULL
NUMBER_OF_SERVING INT (5) NOT NULL
TOTAL_CALORIES DECIMAL NOT NULL
(5,2)
MEMBER_ID VARCHAR FOREIGN
(20) KEY NOT
NULL
DATE DATE (DD- NOT NULL
MON-YYYY)
TYPE_ID INT (3) FOREIGN
KEY
NOT NULL
FOOD_JOURNAL_TYPE TYPE_ID INT (3) PRIMARY
KEY
NOT NULL
DESCRIPTION VARCHAR NOT NULL
(30)
NUTRITION_REPORT REPORT_ID INT(20) PRIMARY
KEY
NOT NULL
CARBS VARCHAR NOT NULL
(15)
CALORIES VARCHAR NOT NULL
(15)
PROTEIN VARCHAR NOT NULL
(15)
CHOLESTEROL VARCHAR NOT NULL
(15)
SODIUM VARCHAR NOT NULL
(15)
SUGARS VARCHAR NOT NULL
(15)
JOURNAL_ID INT (20) FOREIGN
KEY
NOT NULL
JOURNAL REVIEW TRAINER_ID VARCHAR PRIMARY
(20) KEY/
FOREIGN
KEY
NOT NULL
JOURNAL_ID INT (20) PRIMARY
KEY /
FOREIGN
KEY
NOT NULL
COMMENT VARCHAR NOT NULL
(30)
REPORT_ID INT (20) FOREIGN
KEY
NOT NULL
TASK 5
Firstly after reading the assignment, I came to the understanding that I need to prepare a
database model for a Fitness Company, in our case HELPFIT. A system for a business who
parts or sections are related. Member, Trainers, Journals, and other Entities of this assignment
will be related and share a relationship to one another. So we divided up the work, I was
responsible for Section A and my partner for Section B. First I started of I dentifying the
Entities for my section. Then their respective Attributes. Then figuring out the relations
between each Entity, by finding the Primary and Foreign keys. Then the partial and transitive
dependencies. Figuring out the cardinalities between the entities on my side and also keeping
in view of the connections to my partner’s side. The problems that I encountered was how to
figure out a way to create a separate Entity for Food Journal description of weather the meal
was a breakfast, lunch or dinner. Also when figuring out the composite entities in the ER
Diagram. Creating the dumpy entries, had to make sure to follow the already given data of
the member Jane Doh. Had to change the date type for Member Id from INT( which was
initial chosen) to VARCHAR because the data that was give had numbers and alphabets
(M3981 Jane Doh). Same goes to the Trainer ID.

You might also like