0% found this document useful (0 votes)
18 views

Database

The document shows the steps taken to create a MySQL database called "dip3a", create a table called "pelajar" within that database to store student data, and then insert 6 records into that table with details like student ID, name, phone number and address.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Database

The document shows the steps taken to create a MySQL database called "dip3a", create a table called "pelajar" within that database to store student data, and then insert 6 records into that table with details like student ID, name, phone number and address.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

+--------------------+

| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+---------
mysql> create database dip3a;
Query OK, 1 row affected (0.03 sec)

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| dip3a |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)-----------+

mysql> create database dip3a;

Query OK, 1 row affected (0.03 sec)

mysql> use dip3a;

Database changed

mysql> show tables;

Empty set (0.00 sec)

mysql> create table pelajar (

-> no_matrix varchar(13) not null unique,

-> nama varchar(30),

-> no_tefon varchar(11),

-> alamat varchar(30) );


Query OK, 0 rows affected (0.31 sec)

mysql> show tables;

+-----------------+

| Tables_in_dip3a |

+-----------------+

| pelajar |

+-----------------+

1 row in set (0.00 sec)

mysql> select * from pelajar;

Empty set (0.08 sec)

mysql> insert into pelajar values ('17DIP10F2124','Shahrul


Nizam','017-3853316',

'Kajang');

Query OK, 1 row affected (0.06 sec)

mysql> select * from pelajar;

+--------------+---------------+-------------+--------+

| no_matrix | nama | no_tefon | alamat |

+--------------+---------------+-------------+--------+

| 17DIP10F2124 | Shahrul Nizam | 017-3853316 | Kajang |

+--------------+---------------+-------------+--------+

1 row in set (0.01 sec)


mysql> insert into pelajar values ('17DIP10F1234','Razif','017-
2345543','Keramat

');

Query OK, 1 row affected (0.03 sec)

mysql> select * from pelajar;

+--------------+---------------+-------------+---------+

| no_matrix | nama | no_tefon | alamat |

+--------------+---------------+-------------+---------+

| 17DIP10F1234 | Razif | 017-2345543 | Keramat |

| 17DIP10F2124 | Shahrul Nizam | 017-3853316 | Kajang |

+--------------+---------------+-------------+---------+

2 rows in set (0.00 sec)

mysql> insert into pelajar values ('17DIP10F3030','Donut','017-


2999342','cheras'

);

Query OK, 1 row affected (0.09 sec)

mysql> insert into pelajar values ('17DIP10F2210','Khairul','013-


2552375','Gomba

k');

Query OK, 1 row affected (0.05 sec)

mysql> insert into pelajar values ('17DIP10F2345','Sabri','014-


7864453','Damansa

ra');

Query OK, 1 row affected (0.06 sec)


mysql> select * from pelajar;

+--------------+---------------+-------------+-----------+

| no_matrix | nama | no_tefon | alamat |

+--------------+---------------+-------------+-----------+

| 17DIP10F1234 | Razif | 017-2345543 | Keramat |

| 17DIP10F2124 | Shahrul Nizam | 017-3853316 | Kajang |

| 17DIP10F2210 | Khairul | 013-2552375 | Gombak |

| 17DIP10F2345 | Sabri | 014-7864453 | Damansara |

| 17DIP10F3030 | Donut | 017-2999342 | cheras |

+--------------+---------------+-------------+-----------+

5 rows in set (0.00 sec)

mysql> insert into pelajar values ('17DIP10F4545','Asyaraf


Putra','017-3433333',

'Johor');

Query OK, 1 row affected (0.03 sec)

mysql> select * from pelajar;

+--------------+---------------+-------------+-----------+

| no_matrix | nama | no_tefon | alamat |

+--------------+---------------+-------------+-----------+

| 17DIP10F1234 | Razif | 017-2345543 | Keramat |

| 17DIP10F2124 | Shahrul Nizam | 017-3853316 | Kajang |

| 17DIP10F2210 | Khairul | 013-2552375 | Gombak |

| 17DIP10F2345 | Sabri | 014-7864453 | Damansara |

| 17DIP10F3030 | Donut | 017-2999342 | cheras |


| 17DIP10F4545 | Asyaraf Putra | 017-3433333 | Johor |

+--------------+---------------+-------------+-----------+

6 rows in set (0.00 sec)

mysql>

You might also like