0% found this document useful (0 votes)
16 views2 pages

Textsfg

Uploaded by

parasningune19
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)
16 views2 pages

Textsfg

Uploaded by

parasningune19
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
You are on page 1/ 2

Entities:

A. Patient: Represents individuals seeking medical assistance. Attributes may


include Patient ID, Name, Age, Gender, and Medical History.

B. Medicine: Represents the medications available. Attributes could include


Medicine ID, Name, Dosage, Manufacturer, and Price.

C. Pharmacy: Represents the locations or entities where medicines are dispensed.


Attributes might include Pharmacy ID, Name, Address, and Contact Information.

D. Bill: Represents the transaction records of patients purchasing medicines.


Attributes may include Bill ID, Date, Patient ID (foreign key), and Total Amount.

E. Doctor: Represents healthcare professionals who diagnose and prescribe


medications. Attributes might include Doctor ID, Name, Specialization, and Contact
Information.

Relationships:
A. Prescription: Describes the recommendation of medicines by doctors to patients.
It connects the Doctor, Patient, and Medicine entities. This relationship signifies
which doctor prescribed which medicine to which patient.

B. Dispenses: Represents the process of pharmacies providing medicines to patients.


It connects the Pharmacy and Medicine entities, indicating which pharmacy dispenses
which medicines.c. Purchases: Indicates the transaction of patients buying
medicines from pharmacies. It connects the Patient, Medicine, and Bill entities,
showing which patient purchased which medicines resulting in a bill.

Cardinality:a. Prescription: Usually, it's a many-to-many relationship. A doctor


can prescribe multiple medicines to multiple patients, and a patient can receive
prescriptions from multiple doctors.

B. Dispenses: It's typically one-to-many. A pharmacy can dispense the same medicine
to multiple patients, but each medicine is dispensed by one pharmacy.

C. Purchases: Also, it's typically one-to-many. A patient can purchase multiple


medicines resulting in one bill, but each bill corresponds to one patient.

Keys:
A. Patient ID, Medicine ID, Pharmacy ID, and Doctor ID can be primary keys in their
respective entities.

B. Bill ID can serve as the primary key in the Bill entity, also linking it as a
foreign key to the Patient entity.

-----------------------------------------------------------------------------------
-------------

1] Install MySQL:
Download and install MySQL on your computer. You can choose to install MySQL
Community Server, which is freely available for personal use, or you can opt for a
paid version if you need additional features and support.

2] Start MySQL Server:


After installation, start the MySQL server. On most systems, you can do this
by running a command like sudo service mysql start on Linux or macOS, or by
starting the MySQL service from the Control Panel on Windows.
3] Access MySQL Command Line:
Open a terminal or command prompt and access the MySQL command line interface
by typing mysql -u username -p, where username is your MySQL username. You'll be
prompted to enter your password.

4] Create a Database:
Once you're in the MySQL command line interface, you can create a new
database using the CREATE DATABASE statement.

5] Use the Database:


After creating the database, you need to switch to it to perform further
operations. You can do this using the USE statement

6] Design Tables:
Now, you can start designing the structure of your database by creating
tables. Tables define the entities and relationships in your database. You'll need
to decide on the columns (attributes) for each table and the data types for those
columns.

7] Create Tables:
Use the CREATE TABLE statement to create tables in your database.eg:
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
email VARCHAR(100) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

8] Insert Data:
Once your tables are created, you can insert data into them using the INSERT
INTO statement.eg:
INSERT INTO users (username, email) VALUES ('john_doe', '[email protected]');

9] Query and Manage Data:


You can perform various operations on your data using SQL queries. This
includes retrieving data using SELECT statements, updating data using UPDATE
statements, and deleting data using DELETE statements.

You might also like