ASSESSMENT INSTRUCTION
Course Code FCC134 Course Name INTRODUCTION TO DATABASE
Lecturer Dr Akibu Mahmoud Abdullahi
Semester / Year 3/2023 Submission Date 06 September 2023
Assessment LAB 3 Weightage 10 marks (10%)
Course Outcome LO3: Apply the knowledge and skills in database design (C3, PLO9).
Instructions:
➢ Screenshot all the following LAB exercise and paste it on Microsoft word document.
➢ submit the LAB (word document) and the code on eLearning.
1. Create a TABLE (student) with the following attributes using an SQL command.
ID (Varchar) LastName FirstName Age (int) Country
(Varchar) (Varchar) (Varchar)
2. Insert SIX (6) records in the table you have created.
1 Amirullo Azizov 22 Tajikistan
2 Bayramova Medine 20 Turkmenistan
3 Moe Yati 19 Myanmar
4 Waddy Su 18 Myanmar
5 Mohemedh Sharaf 23 Sri Lanka
6 Arkar Moe 22 Myanmar
3. Select the list of the first name, country of the student whose age is more than 20.
4. Retrieve the whole columns.
5. Select the age of the student without showing the duplicate.
6. Change the DATA TYPE of the ID to INTIGER
7. Add new column and name it ADDRESS.
8. Delete the column ADDRESS.
9. Add PRIMARY KEY to the ID column.
10. Delete the PRIMARY KEY
CODE
create database Aiu;
use Aiu;
create table student (id varchar(10), Lastname varchar (20), Firstname varchar(20), Age
int, Country varchar(20));
insert into student ( id, Lastname, Firstname, Age, Country)
values ('1','Amirullo', 'Azizov', 22, 'Tajikistan'),
('2','Bayramova', 'Medine', 20, 'Turkmenistan'),
('3', 'Moe', 'Yati', 19, 'Myanmar'),
('4', 'Waddy', 'Su', 18, 'Myanmar'),
('5', 'Mohemedh', 'Sharaf', 23, 'Sri Lanka'),
('6', 'Arkar', 'Moe', 22, 'Myanmar');
select Firstname, Country from student where age >20;
select * from student;
SELECT DISTINCT age FROM student;
ALTER TABLE student
MODIFY COLUMN id INTEGER;
ALTER TABLE student
ADD COLUMN Address VARCHAR(100);
select * from student;
ALTER TABLE student
Drop Column Address;
select * from student;
Alter table student
add primary key (id);
select * from student;
Alter table student
drop primary key;
select * from student;