In: Computer Science
For this lab we will be taking our various tables (PATIENT, BED, PERSONNEL, DEPARTMENT, TREATMENT, TEST and all ASSOCIATIVE ENTITIES), created from our normalization process and entering them into SQL Server Management Studio.
For each of your tables, you will use SQL and the CREATE TABLE command to create each table with it's various columns (attributes).
You will then use the INSERT INTO command to add 5 rows of data (you make up your own data) to populate each table.
After creating the tables and entering the data - use the SELECT * FROM tablename to list all of the data in each table.
Save all your queries and turn in all queries, each "screen shot" of running each query and each of your tables with all of the data.
1). ANSWER :
GIVENTHAT :
RAW CODE:
create table PATIENT(id int(4),name varchar(20),age
int(3),gender varchar(2));
create table BED(id int(4));
create table PERSONNEL(id int(4),name varchar(20),age int(3),gender
varchar(2));
create table DEPARTMENT(id int(4),name varchar(20));
create table TREATMENT(treatmenttime int(3),cost int(4));
create table TEST(Testid int(4),name varchar(20));
insert into PATIENT
values(1,'Tony',35,'M'),(2,'Clay',18,'M'),(3,'Jenny',20,'F'),(4,'Sony',30,'F'),(5,'Peter',24,'M');
insert into BED values(1),(2),(3),(4),(5);
insert into PERSONNEL
values(1,'Robert',30,'M'),(2,'Lawrence',32,'M'),(3,'Lucy',20,'F'),(4,'Kate',30,'F'),(5,'Leopold',24,'M');
insert into DEPARTMENT
values(140,'Emergency'),(2,'Cardiology'),(3,'Neurology'),(4,'Oncology'),(5,'Gynaecology');
insert into TREATMENT
values(2,10),(7,40),(10,10),(10,50),(3,30);
insert into TEST
values(1,'Bloodcount'),(2,'Bloodtype'),(3,'Kidneytest'),(4,'ESR'),(5,'Sugartest');
select *from PATIENT;
select *from BED;
select *from PERSONNEL;
select *from DEPARTMENT;
select *from TREATMENT;
select *from TEST;