0% found this document useful (0 votes)
149 views2 pages

Database Fundamental (TIS 1101) Tutorial 5: Student

The document provides sample SQL statements to demonstrate how to create a table, insert data into the table, update data in the table, delete data from the table, and add a new column to the table using the STUDENT table as an example. The STUDENT table has fields for student ID, name, major, age, and primary key of student ID. Examples of SQL statements are provided to insert initial data, update a student's major, delete a student that dropped out, and add a new column for faculty to the table.

Uploaded by

Blackk Worldz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views2 pages

Database Fundamental (TIS 1101) Tutorial 5: Student

The document provides sample SQL statements to demonstrate how to create a table, insert data into the table, update data in the table, delete data from the table, and add a new column to the table using the STUDENT table as an example. The STUDENT table has fields for student ID, name, major, age, and primary key of student ID. Examples of SQL statements are provided to insert initial data, update a student's major, delete a student that dropped out, and add a new column for faculty to the table.

Uploaded by

Blackk Worldz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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