0% found this document useful (0 votes)
3 views1 page

Medical Store Database Schema Setup

The document outlines the SQL commands to create a database named 'medical_store' and its associated tables for users, patients, and stock. It includes the structure of each table with relevant fields and data types. Additionally, it provides sample login credentials for an admin and a user.

Uploaded by

kesavchaithram
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Medical Store Database Schema Setup

The document outlines the SQL commands to create a database named 'medical_store' and its associated tables for users, patients, and stock. It includes the structure of each table with relevant fields and data types. Additionally, it provides sample login credentials for an admin and a user.

Uploaded by

kesavchaithram
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

CREATE DATABASE IF NOT EXISTS medical_store;

USE medical_store;

-- Users table
CREATE TABLE IF NOT EXISTS users (
username VARCHAR(50) PRIMARY KEY,
password VARCHAR(50) NOT NULL,
role ENUM('admin', 'user') NOT NULL
);

-- Patients table
CREATE TABLE IF NOT EXISTS patients (
patient_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
age INT,
gender VARCHAR(10),
contact VARCHAR(20)
);

-- Medicines / Stock table


CREATE TABLE IF NOT EXISTS stock (
medicine_id INT AUTO_INCREMENT PRIMARY KEY,
medicine_name VARCHAR(100),
batch_no VARCHAR(50),
quantity INT,
price_per_unit DECIMAL(10, 2),
expiry_date DATE
);

-- Sample login credentials


INSERT IGNORE INTO users VALUES
('admin', 'admin123', 'admin'),
('user1', 'user123', 'user');

You might also like