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

Task 1

The document outlines the structure of a database system consisting of multiple tables including Courses, Documents, Departments, University, Users, and others, each with specific attributes and purposes. It details the relationships between these tables, such as one-to-many and many-to-many connections, illustrating how they interact within the system. The primary focus is on managing educational resources, user information, and transactional data.

Uploaded by

maabdullah.rhs
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Task 1

The document outlines the structure of a database system consisting of multiple tables including Courses, Documents, Departments, University, Users, and others, each with specific attributes and purposes. It details the relationships between these tables, such as one-to-many and many-to-many connections, illustrating how they interact within the system. The primary focus is on managing educational resources, user information, and transactional data.

Uploaded by

maabdullah.rhs
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Database Systems

Project Members:

 Muhammad Abdullah (53457)

1. Courses Table

 Attributes:
o course_id (Primary Key – used to identify the course uniquely)
o course_code (used for storing the code of course offered)
o course_name (used for storing the name of course offered)
o instructor_name (used for storing the name of instructor teaching the course)
o academic_year (used for storing the information of year and semester (e.g fall,
spring, summer) of the course offered)
o semester (used for storing the Semester in which the course is offered)
 Purpose: This table stores information about courses offered, including their unique
identifiers and instructors.
 Foreign Keys: None.

2. Documents Table

 Attributes:
o document_id (Primary Key – uniquely identifying any document)
o upload_date (used for storing the date document was uploaded)
o file_path (used for storing and fetching file via the reference file path of the
document)
o title (used for storing the title/name of the document offered)
o is_free (used for storing the Boolean value of true and false according to
accessibility of document)
o price (used for storing the price of the document)
o description (used for storing the brief description of document)
 Purpose: Tracks uploaded documents and their details, such as availability and pricing.
 Foreign Keys:
o department_id (Links to Departments table)
o user_id (Links to Users table via "Uploaded by")

3. Departments Table

 Attributes:
o department_id (Primary Key)
o department_name (used for storing the name of department)
 Purpose: Represents academic departments associated with courses and documents.
 Foreign Keys:
o university_id (Links to University table)

4. University Table

 Attributes:
o university_id (Primary Key)
o university_name (used for storing the name of university)
o campus_location (used for storing the campus location of the university)
 Purpose: Stores details of universities offering courses and maintaining departments.
 Foreign Keys: None

5. Users Table

 Attributes:
o user_id (Primary Key)
o name (used for storing thename of user consisting of two attributes (first_name
and last_name )
o email (used for storing the email of the user)
o age (used for storing the age of the user)
o contact_no (used for storing the contact number of the user)
o password (used for storing the encrypted password of the user)
o bio (used for storing a brief biography of the user)
o join_date (used for storing the date the user joined the system)
o program (used for storing the academic program of the user, if applicable)
o semester (used for storing the current semester of the user, if applicable)
 Purpose: Captures user information for students.
 Foreign Keys:
o department_id (Links to Departments table via enrollment)

6. Wallet Table

 Attributes:
o wallet_id (Primary Key – uniquely identifying each wallet)
o balance (used for storing the available balance in the wallet)
 Purpose: Manages user wallet balances for transactions.
 Foreign Keys:
o user_id (Links to Users table)

7. Action Log Table

 Attributes:
o log_id (Primary Key – uniquely identifying each action log)
o action_timestamp (used for storing the timestamp of the logged action)
o action_type (used for storing the type of action performed by the user)
o address (used for storing the IP or device address of the user performing the action)
 Purpose: Records user actions within the system.
 Foreign Keys:
o user_id (Links to Users table)

8. Loans Table

 Attributes:
o loan_id (Primary Key – uniquely identifying each loan)
o request_date (used for storing the date when the loan was requested)
o approval_date (used for storing the date when the loan was approved)
o repayment_date (used for storing the date by which the loan should be repaid)
o amount (used for storing the loan amount requested or granted)
o status (used for storing the status of the loan, e.g., pending, approved, rejected)
 Purpose: Tracks loans taken by users.
 Foreign Keys:
o user_id (Links to Users table)

9. Notifications Table

 Attributes:
o notification_id (Primary Key – uniquely identifying each notification)
o is_read (used for storing whether the notification has been read by the user)
o created_date (used for storing the creation date of the notification)
o message (used for storing the content of the notification)
 Purpose: Manages notifications for users.
 Foreign Keys:
o user_id (Links to Users table)
10. Document Stats Table

 Attributes:
o stats_id (Primary Key – uniquely identifying each statistics entry)
o purchases (used for storing the total number of times the document was purchased)
o views (used for storing the total number of times the document was viewed)
 Purpose: Tracks document analytics, such as views and purchases.
 Foreign Keys:
o document_id (Links to Documents table)

11. Files Access Keys Table

 Attributes:
o access_key_id (Primary Key – uniquely identifying each access key)
o access_key (used for storing the generated access key for a file)
o is_used (used for storing whether the access key has been used)
o date_created (used for storing the creation date of the access key)
o used_date (used for storing the date when the access key was used)
 Purpose: Manages file access for users.
 Foreign Keys:
o document_id (Links to Documents table)

12. Tags Table

 Attributes:
o tag_id (Primary Key – uniquely identifying each tag)
o tag_name (used for storing the name of the tag)
 Purpose: Stores tags for categorizing documents and discussions.
 Foreign Keys: None explicitly listed.

13. Document Tags Table

 Attributes:
o document_id (Foreign Key to Documents table)
o tag_id (Foreign Key to Tags table)
 Purpose: Links documents with tags.

14. Discussions Table

 Attributes:
o discussion_id (Primary Key – uniquely identifying each discussion)
o is_read (used for storing whether the discussion has been read by the user)
o created_date (used for storing the creation date of the discussion)
o message (used for storing the content of the discussion)
 Purpose: Facilitates user discussions.
 Foreign Keys:
o user_id (Links to Users table)

15. Discussion Tags Table

 Attributes:
o discussion_id (Foreign Key to Discussions table)
o tag_id (Foreign Key to Tags table)
 Purpose: Links discussions with tags.

16. Discussion Comments Table

 Attributes:
o comment_id (Primary Key – uniquely identifying each comment)
o comment_date (used for storing the date when the comment was made)
o comment_text (used for storing the text of the comment)
 Purpose: Tracks comments made on discussions.
 Foreign Keys:
o discussion_id (Links to Discussions table)

17. Transactions Table

 Attributes:
o transaction_id (Primary Key – uniquely identifying each transaction)
o remaining_balance (used for storing the balance remaining after the transaction)
o transaction_date (used for storing the date of the transaction)
o amount (used for storing the amount involved in the transaction)
o transaction_type (used for storing the type of transaction, e.g., credit, debit)
 Purpose: Records all monetary transactions.
 Foreign Keys:
o user_id (Links to Users table)

Relations
Departments - Courses

 Type: One-to-Many (1:N)


 Description: Each course is associated with a single department, but a department can
offer many courses.
 Connecting Tables:
o Courses references Departments through department_id.

Departments - Universities

 Type: One-to-Many (1:N)


 Description: Each department belongs to a single university, but a university can host
multiple departments.
 Connecting Tables:
o Departments references Universities through university_id.

Departments-Users

 Type: One-to-Many (1:N)


 Description: Users (students) belong to a single department, but a department can have
many users.
 Connecting Tables:
o Users references Departments through department_id.

Users - Documents

 Type: One-to-Many (1:N)


 Description: Each document is uploaded by a single user, but a user can upload multiple
documents.
 Connecting Tables:
o Documents references Users through user_id.

Documents - Tags

 Type: Many-to-Many (M:N)


 Description: Documents can have multiple tags, and a tag can belong to multiple
documents.
 Connecting Tables:
o Document Tags (Intermediary Table with document_id and tag_id).

Discussions - Tags

 Type: Many-to-Many (M:N)


 Description: Discussions can have multiple tags, and a tag can belong to multiple
discussions.
 Connecting Tables:
o Discussion Tags (Intermediary Table with discussion_id and tag_id).

Users - Notifications

 Type: One-to-Many (1:N)


 Description: Users can receive multiple notification, but one notification can only be
sent to one user.
 Connecting Tables:
o Notifications references Users through user_id.
Users – Actions_Log

 Type: One-to-Many (1:N)


 Description: Users can perform multiple Actions, but one action can only be performed
by one user.
 Connecting Tables:
o Actions_log references Users through user_id.

Users – Wallet

 Type: One-to-One (1:1)


 Description: Users can own one wallet.
 Connecting Tables:
o Wallet references Users through user_id.

Users – Loans

 Type: One-to-Many (1:N)


 Description: Users can owe multiple loans, but one loan can only be owed by one user.
 Connecting Tables:
o Actions_log references Users through user_id.

Users – Discussion_comments

 Type: One-to-Many (1:N)


 Description: One User can comment multiple times, but one a comment is written by
only one user.
 Connecting Tables:
o Discussion_comments references Users through user_id.

Users – Discussion

 Type: One-to-Many (1:N)


 Description: One User can open multiple disscussions, but a discussion can be opened by
only one user..
 Connecting Tables:
o Discussion references Users through user_id.

Users – Transaction

 Type: One-to-Many (1:N)


 Description: One User can perform multiple transactions, but one transaction is
performed by only one user.
 Connecting Tables:
o Transaction references Users through user_id.
Documents – File_Access_Keys

 Type: One-to-Many (1:N)


 Description: One Document may be accessed by multiple keys, but one access key can
only be used for one document.
 Connecting Tables:
o File_access_keys references Documents through document_id.

Courses – Documents

 Type: One-to-Many (1:N)


 Description: One document can only belong to one course, but one course can contain
multiple documents.
 Connecting Tables:
o Documents references Courses through course_id.

You might also like