You are on page 1of 5

TDB1131 Database Systems

Tutorial 1
Topic: Introduction

A. Discussion

1. Discuss each of the following terms and provide AT LEAST THREE examples for
each term (do not use the example from the lecture):
a) Data
b) Field
c) Record
d) File

2. What is a DBMS, and what are its functions?

3. What is data redundancy? Give an example to illustrate data redundancy.

4. In your opinion, what is a file system? What are the limitations of file system that
lead to the evolution of database system?

5. Answer the following questions based on the file structure shown in Figure 3.

Figure 1

(i) How many records does the file contain? How many fields are there per record?
Please list the fields.

(ii) What problem would you encounter if you want to produce a listing by state? How
would you solve this problem by altering the file structure?

(iii) Data redundancy is a common problem in a file system. Do you observe such
problem in the file structure (see Figure 1)? Elaborate your answer.

B. Hands-on Exercise: Introduction to MySql (XAMPP)

PRE-PREPARATION BEFORE LAB:


1. Go to: https://www.apachefriends.org/index.html

Page 1 of 5
TDB1131 Database Systems

2. Click to download XAMPP according to the operating system that you have in your PC:

3. Install XAMPP (Continue with installation)

4. You will saw the Xampp icon at your program menu after the installation is
completed.

CREATE A SIMPLE DATABASE & TABLE:


1. Click the icon and you will see the following interface.

6. Click Start
6. Click Shell

1. Under Actions of Apache and MySQL, click Start.


2. Then click Shell.
3. You will see the following DOS:

Page 2 of 5
TDB1131 Database Systems

4. Type the following command, so that we move to the necessary folder (you should
arrive at c:\xampp\mysql\bin):

cd mysql

cd bin

5. In mysql, the default username is root without password. In DOS, type this:

6. It will ask you to enter password. However, we do not set password, just press ENTER.
You will see the following lines:

7. Let us check the existing databases in MariaDB. Type:

Suppose you will see the following:

8. Let us try to create a simple database by using Structured Query Language (the language
for us to tell the database system what action it needs to perform).

Page 3 of 5
TDB1131 Database Systems

To use the database:

You will see Database changed is printed after ENTER:

9. Let us try to create a simple table (for your information, SQL is not case sensitive):

CREATE TABLE trial1(

ID CHAR(5) PRIMARY KEY,

NAME VARCHAR(20) NOT NULL);

10. Input some values to store in the table:

INSERT INTO trial1 VALUES('12345', 'Ng Jin Rui'),

('45612','Mohammed Hisham'),

('52525','Shimala a/p Subarmanium');

11. Display the values in table:

SELECT * FROM trial1;

12. Remove table and database:

DROP TABLE trial1;

DROP DATABASE IF EXISTS testing;

13. Let us end the session. Just type EXIT. This will exit the Xampp program. Type another
EXIT, will close the command prompt. Now, let us select STOP for both Apache and
MySQL.

Page 4 of 5
TDB1131 Database Systems

C. Extra Activities
Extra exploration:
1. Whenever we create a table, we need to define the nature of each piece of
information that we want to store in database.
2. Go to Google, find the data types of database. List out 7 data types that you can
find. In your opinion, what are the common data types that database always used?
3. For example, I want to store students ID, students’ name, students’ email address,
students’ attendance, which day. What kind of datatypes should I assign to each
of this data?

Use online compiler if Xampp is having problem: https://paiza.io/en/languages/mysql

Quotes of the day:

When one door of happiness closes, another opens; but often we look so long at the
closed door that we do not see the one which has been opened for us. ~ Helen Keller

Page 5 of 5

You might also like