Unit 1 Record Writing
Unit 1 Record Writing
Result:
This SQL queries allows for the management of flight details within the 'Flight_details'
table in the 'AAI' database, including database creation, table creation, data insertion, structural
alterations, and data manipulation.
Ex. No: 05 Management of Patient Details in REVA Health Centre Database
Date:
Write an SQL query to create the new database in the name of “REVA_Health_Centre” and
create a table 'Patient_details' with the following structure: patient_id, patient_name, gender,
date_of_birth, place of birth, Contact_No.
Aim:
This exercise aims to demonstrate SQL queries for creating a database named
'REVA_Health_Centre' and a table named 'Patient_details'. We'll perform tasks such as adding
records, altering the table structure by adding a new column, updating existing data, and
displaying specific details.
Commands:
a. Create Database and Table:
>>> CREATE DATABASE REVA_Health_Centre;
>>> USE REVA_Health_Centre;
b. Create the Patient_details table
>>> CREATE TABLE Patient_details (
patient_id INT PRIMARY KEY,
patient_name VARCHAR(100),
gender VARCHAR(10),
date_of_birth DATE,
place_of_birth VARCHAR(100),
Contact_No VARCHAR(15)
);
c. Add 10 Records to the Table:
>>> INSERT INTO Patient_details (patient_id, patient_name, gender,
date_of_birth, place_of_birth, Contact_No) VALUES
(1, 'John Doe', 'Male', '1990-05-15', 'New York', '1234567890'),
(2, 'Jane Smith', 'Female', '1985-08-20', 'Los Angeles', '9876543210'),
(3, 'Michael Johnson', 'Male', '1976-03-10', 'Chicago', '4567890123'),
(4, 'Emily Davis', 'Female', '1999-11-25', 'Houston', '7890123456'),
(5, 'William Brown', 'Male', '1988-07-18', 'Dallas', '2345678901'),
(6, 'Ava Wilson', 'Female', '1995-09-30', 'Miami', '8901234567'),
(7, 'James Taylor', 'Male', '1970-02-05', 'San Francisco', '5678901234'),
(8, 'Olivia Martinez', 'Female', '1983-06-12', 'Seattle', '9012345678'),
(9, 'Ethan Garcia', 'Male', '2002-04-08', 'Denver', '3456789012'),
(10, 'Sophia Rodriguez', 'Female', '1978-12-15', 'Phoenix', '6789012345');
d. Display Table Structure:
>>> DESC Patient_details;
e. Add the Doctor_Name Column:
>>> ALTER TABLE Patient_details ADD Doctor_Name VARCHAR(100);
f. Change the Contact_No of a Particular Patient:
>>> UPDATE Patient_details SET Contact_No = '9988776655' WHERE
patient_id = 1;
g. Display Patient_Name and Doctor_Name Details:
>>> SELECT patient_name, Doctor_Name FROM Patient_details;
Results:
This SQL query allows for the REVA Health Centre database and the Patient_details
table to be successfully created, including the addition of the Doctor_Name column. Contact
numbers for specific patients were updated, and patient names along with Doctor_Name details
were displayed.