Edaba Lab Task 1: Design and Implement Database
Edaba Lab Task 1: Design and Implement Database
DECEMBER 2, 2021
KESHAV DANDEVA
302333
1. Textual description of a database
It offers different types of sports training courses for clients. The clients can be any school, university
or corporate. The courses can be conducted in the client’s premises or in the academy, as per the
preference of the client.
The academy employs coaches and a coach might conduct multiple sports courses. Every coach has
an assistant. The academy has clients and a client might avail multiple sports courses via the
academy. The client then offers the courses to its employees/students, who have the option to
participate.
Each course is offered by one client and each course has one coach at any given time.
Participants in the courses are employees/students of the client. Each participant can be employed
by one client at a time. Participants may be enrolled in more than one course.
1. Coach
In this entity, we store the information about coach. Coach_Id is the primary key and is unique for
every coach. There are attributes to store the personal details of the coach like first name, last name,
date of birth and phone number. The coach can teach multiple courses and thus there is attribute for
Course_1 and Course_2. The Course_1 value cannot be null as the coach must teach at least one
course.
2. Assistant Coach
In this entity, we store details about the assistant coach. Assistant_ID is the primary key and is
unique for every assistant coach. There are attributes to store the personal details of the assistant
coach like first name, last name, date of birth and phone number. Each assistant coach is assigned to
one coach. It can only have one coach and thus the attribute Coach_Id which cannot be null. The
assistant coach can teach multiple courses as well and thus there is attribute for Course_1 and
Course_2. The Course_1 value cannot be null as the assistant coach must teach at least one course.
3. Course
In this entity, we store details about the course. Course_Id is the primary key and is unique for every
course. There are attributes to store details of the course like course_name, sport (for the sport
conducted in the course), stage (for the level of the course e.g., beginner), course_duration_weeks
(for the total duration of the course in weeks), start_date (for the starting date of the course),
in_academy (to know if the course is conducted in academy or clients premises; value stored in this is
Y/N), coach (for the coach who will be conducting this course) and client (for the client who has
availed this course).
4. Client
In this entity, we store the details about the client. The client_id is the primary key and is unique for
every client. The other details of the client is stored in attributes like client_name, address and
industry (for the type of client e.g., school).
5. Participant
In this entity, we store the details about the participant of a course. All the employees/student of the
client that take part in the course are considered as participant for the course by the academy. The
participant_id is the primary key of the participant and is unique for every participant. The other
details of the participant is stored in attributes like first_name, last_name, phone_no and client (for
knowing what client does the participant belong to).
ERD and their Relationships
• Coach is related to Course with 1 to many relationship as 1 coach can coach multiple courses
but a course can only have 1 coach.
• Coach is related to Assistant Coach with 1 to 1 relationship as 1 coach can only have 1
assistant coach and vice versa.
• Course is related to Assistant Coach with many to 1 relationship as one assistant coach can
assist in coaching many courses but course can have only 1 assistant coach.
• Course is related to Client with many to 1 relationship as client can avail multiple courses but
a course can only have 1 client.
• Course is related to Participant with many to many relationship as course can have multiple
participants and a participant can have multiple courses.
• Client is related to Participant with 1 to many relationship as many participants can be
working for the client but a participant will only have 1 client who he/she works for.
3. Relational Schema
So, for my database, first I identified all Many-to-Many Relationships and replaced them with proxy
entity and two one-to-many relationships. This is done for the relationship between Participant and
Courses. As can be seen from the relational schema above, the new proxy entity takes is present
between them with many to one relation to Participant and Course.
Then, each ERD’s relationship is represented as Foreign Key (FK) – special column with dedicated
property marked in a table with FK mark - pointing Primary Key (PK) in relational schema (table’s
scope).
1) In the case of One-To-Many relationship, that is between Participant and Course, we add FK to the
table that comes from entity where is pinned the relationship’s cardinality Many
2) In a case of One-To-One relationship, that is between Assistant Coach and Coach we can add FK to
any of tables representing entities joined by the given relationship.
DDL Script