Kamis, 17 Januari 2013

TUGAS MODUL 1



Tugas modul 1

mysql> create database pethouse;
Query OK, 1 row affected (0.05 sec)

mysql> use pethouse;
Database changed
mysql> create table event(name varchar(20), date date, type varchar(15), remark varchar(225));
Query OK, 0 rows affected (0.22 sec)

mysql> desc event;
+--------+--------------+------+-----+---------+-------+
| Field  | Type         | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| name   | varchar(20)  | YES  |     | NULL    |       |
| date   | date         | YES  |     | NULL    |       |
| type   | varchar(15)  | YES  |     | NULL    |       |
| remark | varchar(225) | YES  |     | NULL    |       |
+--------+--------------+------+-----+---------+-------+
4 rows in set (0.05 sec)

mysql> insert into event values('Fluffy','1995-05-15','litter','4 kittens, 3 female, 1 male'),('Buffy','1993-06-23','litter','5 puppies, 2 female, 3 male'),('Buffy','1994-06-19','litter','3 puppies, 3 female'),('Chirpy','1999-03-21','vet','needed beak straightened');
Query OK, 4 rows affected (0.04 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql> select * from event;
+--------+------------+--------+-----------------------------+
| name   | date       | type   | remark                      |
+--------+------------+--------+-----------------------------+
| Fluffy | 1995-05-15 | litter | 4 kittens, 3 female, 1 male |
| Buffy  | 1993-06-23 | litter | 5 puppies, 2 female, 3 male |
| Buffy  | 1994-06-19 | litter | 3 puppies, 3 female         |
| Chirpy | 1999-03-21 | vet    | needed beak straightened    |
+--------+------------+--------+-----------------------------+
4 rows in set (0.00 sec)

mysql> load data local infile 'D:\smbd.txt' into table event;
Query OK, 6 rows affected (0.12 sec)
Records: 6  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from event;
+----------+------------+----------+-----------------------------+
| name     | date       | type     | remark                      |
+----------+------------+----------+-----------------------------+
| Fluffy   | 1995-05-15 | litter   | 4 kittens, 3 female, 1 male |
| Buffy    | 1993-06-23 | litter   | 5 puppies, 2 female, 3 male |
| Buffy    | 1994-06-19 | litter   | 3 puppies, 3 female         |
| Chirpy   | 1999-03-21 | vet      | needed beak straightened    |
|Slim      |1997-08-03  | vet      | broken rib                  |
|Bowser    | 1991-10-12 | kennel   |                             |
|Fang      | 1991-10-12 |kennel    |                             |
|Fang      | 1998-08-28 | birthday | Gave him a new chew toy     |
|Claws     | 1998-03-17 | birthday | Gave him a new flea collar  |
| Whistler |998-12-09   | birthday | First birthday              |
+----------+------------+----------+-----------------------------+
10 rows in set (0.00 sec)

Tidak ada komentar:

Posting Komentar