The Diabetes Prediction Project aims to analyze a comprehensive dataset of diabetic patients using MySQL to derive insightful information about their health metrics. The dataset includes various attributes such as patient identifiers, smoking status, HbA1c levels, blood pressure, BMI, and blood glucose levels. This project addresses specific queries and suggests database improvements for better performance and data integrity.
- Standardized the patient date of birth (D.O.B) format.
- Corrected date formatting issues such as invalid dates (e.g., "29-02-1995").
- Converted the original dataset to CSV format for better compatibility with SQL.
- Created a SQL table named
employee
with the following schema:CREATE TABLE `diabetes`.`employee` ( `EmployeeName` VARCHAR(45) NOT NULL, `Patient_id` VARCHAR(45) NOT NULL, `gender` VARCHAR(45) NOT NULL, `D.O.B` DATE NOT NULL, `hypertension` INT(5) NOT NULL, `heart_disease` INT(5) NOT NULL, `smoking_history` VARCHAR(45) NOT NULL, `bmi` DOUBLE NOT NULL, `HbA1c_level` DOUBLE NOT NULL, `blood_glucose_level` INT(5) NOT NULL, `diabetes` INT(5) NOT NULL, PRIMARY KEY (`Patient_id`) ) COMMENT = 'Employee Health Data';
- Imported the dataset from Excel into the SQL database using the Table Data Import Wizard.
- Verified the total number of entries in the employee table (100,000 entries).
- Retrieve the Patient_id and ages of all patients.
- Select all female patients who are older than 30.
- Calculate the average BMI of patients.
- List patients in descending order of blood glucose levels.
- Find patients who have hypertension and diabetes.
- Determine the number of patients with heart disease.
- Group patients by smoking history and count smokers and non-smokers.
- Retrieve the Patient_id of patients with a BMI greater than the average BMI.
- Find the patient with the highest and lowest HbA1c levels.
- Calculate the age of patients.
- Rank patients by blood glucose level within each gender group.
- Update the smoking history of patients older than 40 to "Ex-smoker."
- Insert a new patient into the database.
- Delete all patients with heart disease from the database.
- Find patients who have hypertension but not diabetes using the EXCEPT operator.
- Define a unique constraint on the "patient_id" column.