You are on page 1of 12

Course Code & Course: EC601 DATABASE SYSTEM

Programme: DTK 6
Assessment task: PRACTICAL WORK 6
Student Learning Time (SLT) : 60 minutes

Lecturer:
Date:
Total marks : (30
report) +
(70 rubric)
Duration: 4 hours

TITLE

: Create & Modify Database Using GUI and CLI


: CLO2, LD1
OUTCOMES
: By the end of this laboratory session, you should be able to:
1. Create table in database
2. See the comparison
3. Building another tables
4. Create duplicate table in selected database
5. Modifying the table
6. Insert record/tuple in existing table.
7. Modify record in existing table(s).
CLO

EQUIPMENTS & COMPONENTS


1. Computer
2. MySQL Workbench

Theory: creating database can be in two forms, using GUI or using CLI. In this
lab we will expose to both lab.
Activity Outcome: Create database. Create database named DTK6.

Procedures:
1. Open MySQL Workbench as usual. Click new connection under SQL development.

2. A new windows Connect to Database will appear, name the connection as test.
Click Store in Vault according to password, key in password as admin.

3. Click Okay. A new connection will appear, right click on the connection name test
and select Start Command Line Client

4. Another window will appear.Its shows that we have enter MySQL command
line interface.

5. Type CREATE DATABASE DTK6;


Once finished,enter the command SHOW DATABASES;

ACTIVITY A : Create table in database


1 . Here we want to create tables named STUDENT, SUBJECT and RESULT. Click on SQL
tab or
{CLI - Run command USE your_database_name; and press Enter key}

2. Type the following command and click Execute.


CREATE TABLE STUDENT
( STUNO VARCHAR(3) PRIMARY KEY,
STUNAME VARCHAR(30),
ADDRESS VARCHAR(30) );

Question 1: Type the command to see all the data from table student. (1m)

ACTIVITY B : See the comparison


1. Then, type command DESC STUDENT; and press Enter.
2. Go to MySQL WB and see the results by clicking on the test.
Question 2: What is the result? Discuss what did you see and print into the report. (1m)
Question 3: What is means by VARCHAR (30) in SQL command? (1m)
The CHAR and VARCHAR types are declared with a length that indicates the maximum number of characters you want to store.
For example, VARCHAR(30) can hold up to 30 characters.

ACTIVITY C : Building another tables


1. Type the following command for a table named Subject.

CREATE TABLE SUBJECT


(SUBJECTCODE VARCHAR(5),
SUBJECTNAME VARCHAR(30),
PRIMARY KEY (SUBJECTCODE));
Question 4: How can we see the result? (1m)
Discuss the command to use, describe what did you see and print into the report. (1m)

2. Type the following command for a table named Result.

CREATE TABLE RESULT


(STUNO VARCHAR(3),
SUBJECTCODE VARCHAR(5),
MARK INT,
GRADE CHAR(1));
Question 5: How can we see the result? (1m)
Discuss the command to use, describe what did you see and print into the report.

ACTIVITY D : Create duplicate table in selected database


1. Type the following SQL command:
CREATE TABLE STUDENT2 AS SELECT * FROM STUDENT;
2. to see the tables that youve been made in dtk6 database, type command SHOW
TABLES; and press Enter.
3. Type command SELECT * FROM STUDENT2; and press Enter. Please take
a note / print result.
Question 6: Now you MUST see what is residing in student2 table. How
this task can be done? (1m)
After obtaining the output, discuss what you can see.

ACTIVITY E : Modifying the table


1. Type the following SQL command to modify table student2.
ALTER TABLE STUDENT2
ADD EMAIL VARCHAR (20);

2. Obtain the output.

Question 7: What is the result? Discuss what did you see and print into
the report. (1m)

3. Type the following SQL command to modify column in existing table.


ALTER TABLE STUDENT2

MODIFY EMAIL CHAR(25);


4. Obtain the output.

Question 8: What is the result? Discuss what did you see and print into
the report. (1m)

5. Type the following SQL command to modify column in existing table


ALTER TABLE STUDENT2
DROP EMAIL;
7. Type command DESC STUDENT2; and press Enter.
Question 9: What is the result? Discuss what did you see and print into
the report. (1m)

8. Type the following SQL command to modify column in existing table


DROP TABLE STUDENT2;
9. Type command SHOW TABLES;
Question 10: What is the result? Discuss what did you see and print
into the report. (1m)

The following activities must EXECUTED in MySQL GUI query

ACTIVITY F : Insert record/tuple in existing table.


1. Type the following SQL command to insert record/ tuple in existing table in
MySQL GUI query.
INSERT INTO STUDENT VALUES ('S01','BADLI','KUALA LUMPUR');
INSERT INTO STUDENT VALUES ('S02','AMIN','IPOH');
INSERT INTO STUDENT VALUES ('S03','GANESH','TAIPING');
INSERT INTO STUDENT VALUES ('S04','SUZANA','KUCHING');
INSERT INTO STUDENT VALUES ('S05','INTAN','MUAR');
INSERT INTO STUDENT VALUES ('S06','AZHARI','KOTA BHARU');
INSERT INTO STUDENT VALUES ('S07','HUSNA','ALOR SETAR');
2. Type a command to obtain the output in both MySQL Workbench and mySQL CLI.

Question 11: What is the result? Discuss what did you see and print
into the report. (2m)
3. Type the following SQL command to insert record/ tuple in existing table in
MySQL GUI query.
INSERT INTO SUBJECT VALUES ('EC601','DATABASES SYSTEMS');
INSERT INTO SUBJECT VALUES ('ET101','ELECTRICAL TECHNOLOGY');
INSERT INTO SUBJECT VALUES ('ET102','ELECTRICAL WIRING');

4. Type a command to obtain the output in both MySQL Workbench and mySQL CLI.
Question 12: What is the result? Discuss what did you see and print
into the report. (2m)

5. Type the following SQL command to insert record/ tuple in existing table in

MySQL GUI query.


INSERT INTO SUBJECT VALUES ('EC601','DATABASES SYSTEMS');
INSERT INTO SUBJECT VALUES ('ET101','ELECTRICAL TECHNOLOGY');
INSERT INTO SUBJECT VALUES ('ET102','ELECTRICAL WIRING');
6. Type a command to obtain the output in both MySQL Workbench and mySQL CLI.

Question 13: What is the result? Discuss what did you see and print
into the report. (2m)

7. Type the following SQL command to insert record/ tuple in existing table in
MySQL GUI query.
INSERT INTO RESULT VALUES('S01','EC601', 80, 'A');
INSERT INTO RESULT VALUES('S02','EC601', 75, 'B');
INSERT INTO RESULT VALUES('S03','EC601', 55, 'C');
INSERT INTO RESULT VALUES('S05','ET101', 82, 'A');
INSERT INTO RESULT VALUES('S04','ET101', 85, 'A');
INSERT INTO RESULT VALUES('S06','ET102', 78, 'B');

8. Type a command to obtain the output in both MySQL Workbench and mySQL CLI.

Question 14: What is the result? Discuss what did you see and print
into the report. (2m)

Activity G : Modify record in existing table(s).


1. Type the following command IN MySQL WB to modify a record.
UPDATE STUDENT
SET STUNAME = MUHAMMAD WHERE STUNO = S01;
2. Type a command to obtain the output in both MySQL Workbench and mySQL CLI.

Question 15: What is the result? Discuss what did you see and print
into the report. (2m)

3. Type the following command IN MySQL WB to delete a record.


DELETE FROM STUDENT WHERE STUNO = 'S06';
4. Type a command to obtain the output in both MySQL Workbench and mySQL CLI.

Question 16: What is the result? Discuss what did you see and print
into the report.
REPORT(2m)
Please include the following item in your report:

1.
2.
3.
4.
5.
6.
7.

Title 2 marks
Outcomes 2 marks
Procedure - 2 marks
Result 6 marks
Questions - 10 marks
Discussion for both activity 5 marks
Conclusion 3 marks

REFERENCE BOOK
Anderson V. (2003). Microsoft Office 2003: The Complete Reference. Osborne
McGraw-Hill. (ISBN: 0-072-22917-9)
Connolly T.M and Begg C.E (2009). Database System A Practical Approach to
Design, Implementation and Management 5th Edition. Pearson Addison Wesley.
(ISBN: 0-321-521306-5)

RUBRIC OF PRACTICAL WORK

LAB 6: Create & Modify Database Using GUI and CLI


Learning
Domain

No

Aspects

Create Database Using GUI and CLI

(LD)

1.

2.

A. Create table
in database
Able to create
table with steps
given.
B. See the
comparison
Able to
compare the
appearance
using GUI and
CLI.

Unsatisfactor

Excellent

Very Good

Good

Fair

10

7-9

4-6

1-3

y
0

Student can
understand and
able to create
table with
successfully
without being
assisted.

Student can
understand
and able to
create table
successfully
after being
assisted.

Student can
understand
and able to
create table
but complete
only some.

Student can
understand
but unable
create table.

Student did
not
understand
and unable
to create
table.

Student can
Student can
understand and
understand
able to
and able to
compare the
compare the
appearance
appearance
using GUI and using GUI and
CLI without
CLI after
being
being
assisted.
assisted.

Student can
understand
and able to
compare the
appearance
using GUI and
CLI but
complete
only some.

Student can
understand
but unable to
compare the
appearance
using GUI and
CLI.

Student did
not
understand
and unable
to compare
the
appearance
using GUI
and CLI.

Points

CLO2, LD1

3.

4.

5.

C. Building
another
tables
Able to build
another table in
database.
D. Create
duplicate
table in
selected
database.
Able to
duplicate table
in selected
database.

E. Modifying the
table
Able to modify
the table.

Student can
understand and
able to build
another table in
database
without being
assisted.

Student can
understand
and able to
build another
table in
database
after being
assisted.

Student can
Student can
understand and
understand
able to
and able to
duplicate table duplicate table
in selected
in selected
database
database
without being after being
assisted.
assisted.

Student can
understand and
able to modify
the table
without being
assisted.

Student can
understand
and able to
modify the
table after
being
assisted.

Student can
understand
and able to
build another
table in
database but
completes
only some.

Student can
understand
but unable to
build another
table in
database.

Student did
not
understand
and unable
to build
another
table in
database.

Student can
understand
and able to
duplicate table
in selected
database but
complete
only some.

Student can
understand
but unable to
duplicate table
in selected
database.

Student did
not
understand
and unable
to duplicate
table in
selected
database.

Student can
understand
and able to
modify the
table but
complete
only some.

Student can
understand
but unable to
modify the
table.

Student did
not
understand
and unable
to modify the
table.

CLO2, LD1Modify Database Using GUI and CLI

6.

7.

F. Insert
record/tuple
in existing
table.
Able to Insert
record/tuple in
existing table.

G. Modify record
in existing
table(s).
Able to modify
record in
existing
table(s).

Student can
Student can
understand
understand and
and able to
able to Insert
Insert
record/tuple in
record/tuple in
existing table
existing table
without being
after being
assisted.
assisted.

Student can
understand
and able to
Insert
record/tuple in
existing table
but complete
only some.

Student can
Student can
understand
understand
and able to
and able to
modify record
modify record
in existing
in existing
table(s)
table(s) after
Without being
being
assisted.
assisted.

Student can
understand
and able to
modify record
in existing
table(s).but
complete
only some.

Student can
understand
but unable to
Insert
record/tuple in
existing table.

Student did
not
understand
and unable
to Insert
record/tuple
in existing
table.

Student can
understand
but unable to
modify record
in existing
table(s).

Student did
not
understand
and unable
to modify
record in
existing
table(s)..

You might also like