Veteran-Owned

Top Rated by ComputerScience.org

Affordable Coding Bootcamp

4.6/5 Facebook Reviews

Example Patient Data Stored in a MySQL Database in SQL Format

By Stephen Fitzmeyer, MD

here is an example of patient data stored in a MySQL database in SQL format:

CREATE TABLE patients (

    patient_id INT AUTO_INCREMENT PRIMARY KEY,

    name VARCHAR(50) NOT NULL,

    age INT NOT NULL,

    gender VARCHAR(10) NOT NULL,

    diagnosis VARCHAR(100),

    medication VARCHAR(100),

    medication_start_date DATE,

    medication_end_date DATE

);

INSERT INTO patients (name, age, gender, diagnosis, medication, medication_start_date, medication_end_date)

VALUES (‘John Smith’, 45, ‘Male’, ‘Diabetes’, ‘Metformin’, ‘2021-01-01’, ‘2022-01-01’),

       (‘Jane Doe’, 35, ‘Female’, ‘Hypertension’, ‘Lisinopril’, ‘2021-02-01’, ‘2022-02-01’),

       (‘Mike Johnson’, 50, ‘Male’, ‘Chronic Obstructive Pulmonary Disease’, ‘Albuterol’, ‘2021-03-01’, ‘2022-03-01’),

       (‘Sarah Lee’, 28, ‘Female’, ‘Anxiety’, ‘Sertraline’, ‘2021-04-01’, ‘2022-04-01’);

This creates a table called “patients” with columns for patient_id, name, age, gender, diagnosis, medication, medication_start_date, and medication_end_date. The INSERT statements add four patient records to the table, each with a name, age, gender, diagnosis, medication, medication start date, and medication end date. This is just an example, and the table structure and data can be customized to suit your specific healthcare application.

Author: Stephen Fitzmeyer, M.D.
Physician Informaticist
Founder of Patient Keto
Founder of Warp Core Health
Founder of Jax Code Academy, jaxcode.com

Connect with Dr. Stephen Fitzmeyer:
Twitter: @PatientKeto
LinkedIn: linkedin.com/in/sfitzmeyer/