Entities Structures in SQL Format
CREATE TABLE User (
UserID INT PRIMARY KEY,
Name VARCHAR(255),
Age INT,
Gender VARCHAR(10),
Height DECIMAL(5, 2),
Weight DECIMAL(5, 2),
Email VARCHAR(255)
);
CREATE TABLE Activity (
ActivityID INT PRIMARY KEY,
UserID INT,
Type VARCHAR(50),
Duration INT,
Distance DECIMAL(8, 2),
CaloriesBurned DECIMAL(8, 2),
Date DATE,
FOREIGN KEY (UserID) REFERENCES User(UserID)
);
CREATE TABLE Nutrition (
NutritionID INT PRIMARY KEY,
UserID INT,
MealType VARCHAR(20),
FoodItem VARCHAR(255),
Quantity DECIMAL(8, 2),
Calories DECIMAL(8, 2),
Date DATE,
FOREIGN KEY (UserID) REFERENCES User(UserID)
);
CREATE TABLE Goal (
GoalID INT PRIMARY KEY,
UserID INT,
GoalType VARCHAR(50),
TargetValue DECIMAL(8, 2),
Progress DECIMAL(8, 2),
Deadline DATE,
FOREIGN KEY (UserID) REFERENCES User(UserID)
);
How to Design a Database for Health and Fitness Tracking Applications
The health and fitness tracking industry has witnessed strong popularity with the advancement of wearable devices and mobile applications. A well-structured database tailored to the specific needs of this domain is crucial for managing user data, tracking fitness activities, and providing personalized insights.
In this article, we will explore the key components involved in designing a relational database for health and fitness tracking applications, including entity identification, table creation, relationship establishment, and data integrity enforcement.
Contact Us