Database Fundamental (TIS 1101) Tutorial 5: Student

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Database Fundamental (TIS 1101)

Tutorial 5

Q1. Write the SQL statement to create this table. You should determine the
appropriate data types from the data given. (You may add your own data to this
set if you like)

STUDENT
Student_id Student_Name Major Age
10000 Jamal Economy 21
15000 Putih Communication 19
20000 Bakar Economy 25
25000 Gibson Management 24
35000 Rohaya Computer Sc 20
40000 Remi <null> 19

create table STUDENT


( student_id int not null,
student_name varchar(30) not null,
major varchar(20),
age int,
primary key (student_id)
);

Q2. What is the command to enter the data into the table. Give an example of the
command baased on table above.

Insert into STUDENT values (10000, ‘Jamal’, ‘Economy’, 21);


Insert into STUDENT values (15000, ‘Putih’, ‘Communication’, 19);
Insert into STUDENT values (20000, ‘Bakar’, ‘Economy’, 25);

Q3. Jamal has changed his major to Mathematic. Write the SQL update statement to
reflect the changes in the table.

Update STUDENT set Major = ‘ Mathematic’


where student_name = ‘Jamal’;
Q4. Bakar has dropped out. Remove his data from the table.

Delete from STUDENT where student_name = ‘Bakar’;

Q5. Write the SQL statement to add a new column named Faculty to the table.

Alter table STUDENT


Add column Faculty char(3);

You might also like