You are on page 1of 3

LAB ACTIVITY 1: Structured Query Language (SQL)

1. Create a table doctor with the following columns


Doc_Id , First_Name -- It should not be null ,Last_name -- It should not be null
Age, Sex, Salary, Phone #, Pre_date_time
2. Insert the following values.
Doc_id First_name Last_name age sex salary Pre_date_time
1 addisu Ginbu 33 m 12,000 2015-1-10 10:03:33
2 Tadilo tesema 30 m 10,000 2015-1-10 11:05:55
3 Himanot selamu 54 f 10,000 2015-1-10 9:00:44
4 Tigist Almayehu 36 f 15,000 2015-1-10 7:03:21
5 derso dawit 55 m 11,000 2015-1-10 6:00:23
3. Add column Specialization in Table doctor and insert the following values
Alter table Doctor Update doctor
Add Specialization varchar (15); Set Specialization=’ Surgeon’
Where first_name=’ derso’
Update doctor And last_name=’ dawit’
Set Specialization=’SurgeonA’
Where first_name=’addisu’ 4. Update doctor
And last_name=’ginbu’ Set first_name = 'yeshewas',
last_name= 'taddess' Where doc_id = 1;
Update doctor
5. Retrieve all records from doctor
Set Specialization=’Pediatrican’
Select * from doctor
Where first_name=’ Tadilo’
6. From Doctor table, display only First_name,
And last_name=’ tesema’
Last_name, salary
1. List the doctors whose salary is gather than 12,000
Update doctor
SELECT * FROM doctor
Set Specialization=’ SurgeonB’
WHERE Price > 12,000;
Where first_name=’ Himanot’
7. Delete column salary in table doctor
And last_name=’ selamu’ Alter table Doctor
Drop column Salary;
Update doctor 8. List any type surgeon
Set Specialization=’ Psychiatrist’ SELECT * FROM doctor
WHERE LIKE Specialization '%surgeon ';
Where first_name=’ Tigist’ 9. List only type surgeon
And last_name=’ Almayehu’ SELECT * FROM doctor
WHERE LIKE Specialization '_surgeonA';
10. deletes all rows in the "doctor" table, without
deleting the table:
DELETE FROM doctor;

You might also like