Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.37-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database Customer;
Query OK, 1 row affected (0.00 sec)
mysql> use Customer;
Database changed
mysql> create table Customer
-> (Cust_Num char(3) primary key,
-> Cust_Name char(20),
-> Street char(25),
-> City char(15),
-> Balance decimal(8,2),
-> Credit_Limit decimal(8,2),
-> Rep_Num char(3));
Query OK, 0 rows affected (0.13 sec)
mysql> insert into Customer values
-> ('148','Hot Sports Center','2115 Jln Mansoor','Kangar','6550.00','7500.00
','20');
Query OK, 1 row affected (0.06 sec)
mysql> insert into Customer values
-> ('282','Panas Direct','3827 Nawawi','Kuching','431.540','10000.00','35');
Query OK, 1 row affected (0.05 sec)
mysql> insert into Customer values
-> ('356','Fergusons','482 WildWest','Delhi','5785.00','7500.00','65');
Query OK, 1 row affected (0.05 sec)
mysql> insert into Customer values
-> ('408','Everyone Corner','1827 Fojia','Tunis','5285.00','5000.00','35');
Query OK, 1 row affected (0.03 sec)
mysql> insert into Customer values
-> ('462','Bergains Galore','3829 Central','Klang','3412.00','10000.00','65'
);
Query OK, 1 row affected (0.03 sec)
mysql> insert into Customer values
-> ('524','klines','838 Ridge Central','Tripoli','12762.00','15000.00','20')
;
Query OK, 1 row affected (0.03 sec)
mysql> insert into Customer values
-> ('608','Uncle Don','321 Nizra','Kuching','2100.00','10000.00','65');
Query OK, 1 row affected (0.05 sec)
mysql> insert into Customer values
-> ('687','Lees Conner','213 West','Penang','2851.00','5000.00','35');
Query OK, 1 row affected (0.05 sec)
mysql> select*
-> from Customer;
+----------+-------------------+-------------------+---------+----------+-------
-------+---------+
| Cust_Num | Cust_Name | Street | City | Balance | Credit
_Limit | Rep_Num |
+----------+-------------------+-------------------+---------+----------+-------
-------+---------+
| 148 | Hot Sports Center | 2115 Jln Mansoor | Kangar | 6550.00 | 7
500.00 | 20 |
| 282 | Panas Direct | 3827 Nawawi | Kuching | 431.54 | 10
000.00 | 35 |
| 356 | Fergusons | 482 WildWest | Delhi | 5785.00 | 7
500.00 | 65 |
| 408 | Everyone Corner | 1827 Fojia | Tunis | 5285.00 | 5
000.00 | 35 |
| 462 | Bergains Galore | 3829 Central | Klang | 3412.00 | 10
000.00 | 65 |
| 524 | klines | 838 Ridge Central | Tripoli | 12762.00 | 15
000.00 | 20 |
| 608 | Uncle Don | 321 Nizra | Kuching | 2100.00 | 10
000.00 | 65 |
| 687 | Lees Conner | 213 West | Penang | 2851.00 | 5
000.00 | 35 |
+----------+-------------------+-------------------+---------+----------+-------
-------+---------+
8 rows in set (0.00 sec)
mysql> create table Orders
-> (Order_Num char(5) primary key,
-> Order_Date DATE,
-> Cust_Num char(3));
Query OK, 0 rows affected (0.06 sec)
mysql> insert into Orders values
-> ('21608','2008-09-20','148');
Query OK, 1 row affected (0.03 sec)
mysql> insert into Orders values
-> ('21610','2008-09-20','356');
Query OK, 1 row affected (0.03 sec)
mysql> insert into Orders values
-> ('21613','2008-09-21','408');
Query OK, 1 row affected (0.05 sec)
mysql> insert into Orders values
-> ('21614','2008-09-21','282');
Query OK, 1 row affected (0.02 sec)
mysql> insert into Orders values
-> ('21617','2008-09-23','608');
Query OK, 1 row affected (0.01 sec)
mysql> insert into Orders values
-> ('21619','2008-09-23','148');
Query OK, 1 row affected (0.03 sec)
mysql> insert into Orders values
-> ('21623','2008-09-23','608');
Query OK, 1 row affected (0.03 sec)
mysql> select*
-> from Orders;
+-----------+------------+----------+
| Order_Num | Order_Date | Cust_Num |
+-----------+------------+----------+
| 21608 | 2008-09-20 | 148 |
| 21610 | 2008-09-20 | 356 |
| 21613 | 2008-09-21 | 408 |
| 21614 | 2008-09-21 | 282 |
| 21617 | 2008-09-23 | 608 |
| 21619 | 2008-09-23 | 148 |
| 21623 | 2008-09-23 | 608 |
+-----------+------------+----------+
7 rows in set (0.00 sec)
mysql> select C.Cust_Num, O.Order_num, Order_Date from Customer C, Orders O wher
e C.Cust_Num=O.Cust_Num;
+----------+-----------+------------+
| Cust_Num | Order_num | Order_Date |
+----------+-----------+------------+
| 148 | 21608 | 2008-09-20 |
| 356 | 21610 | 2008-09-20 |
| 408 | 21613 | 2008-09-21 |
| 282 | 21614 | 2008-09-21 |
| 608 | 21617 | 2008-09-23 |
| 148 | 21619 | 2008-09-23 |
| 608 | 21623 | 2008-09-23 |
+----------+-----------+------------+
7 rows in set (0.00 sec)
mysql> select C.Cust_Num,Cust_Name,O.Order_Num,Order_Date from Customer C,Orders
O where C.Cust_Num=O.Cust_Num;
+----------+-------------------+-----------+------------+
| Cust_Num | Cust_Name | Order_Num | Order_Date |
+----------+-------------------+-----------+------------+
| 148 | Hot Sports Center | 21608 | 2008-09-20 |
| 356 | Fergusons | 21610 | 2008-09-20 |
| 408 | Everyone Corner | 21613 | 2008-09-21 |
| 282 | Panas Direct | 21614 | 2008-09-21 |
| 608 | Uncle Don | 21617 | 2008-09-23 |
| 148 | Hot Sports Center | 21619 | 2008-09-23 |
| 608 | Uncle Don | 21623 | 2008-09-23 |
+----------+-------------------+-----------+------------+
7 rows in set (0.00 sec)
mysql> select Customer.Cust_Num,Cust_Name,Order_Num,Order_Date from Customer INN
ER JOIN ORDERS ON Customer.Cust_Num=Orders.Cust_Num ORDER BY Customer.Cust_Num;
+----------+-------------------+-----------+------------+
| Cust_Num | Cust_Name | Order_Num | Order_Date |
+----------+-------------------+-----------+------------+
| 148 | Hot Sports Center | 21608 | 2008-09-20 |
| 148 | Hot Sports Center | 21619 | 2008-09-23 |
| 282 | Panas Direct | 21614 | 2008-09-21 |
| 356 | Fergusons | 21610 | 2008-09-20 |
| 408 | Everyone Corner | 21613 | 2008-09-21 |
| 608 | Uncle Don | 21623 | 2008-09-23 |
| 608 | Uncle Don | 21617 | 2008-09-23 |
+----------+-------------------+-----------+------------+
7 rows in set (0.03 sec)
mysql> select Customer.Cust_Num,Cust_Name,Order_Num,Order_Date from Customer LEF
T JOIN ORDERS ON Customer.Cust_Num=Orders.Cust_Num ORDER BY Customer.Cust_Num;
+----------+-------------------+-----------+------------+
| Cust_Num | Cust_Name | Order_Num | Order_Date |
+----------+-------------------+-----------+------------+
| 148 | Hot Sports Center | 21608 | 2008-09-20 |
| 148 | Hot Sports Center | 21619 | 2008-09-23 |
| 282 | Panas Direct | 21614 | 2008-09-21 |
| 356 | Fergusons | 21610 | 2008-09-20 |
| 408 | Everyone Corner | 21613 | 2008-09-21 |
| 462 | Bergains Galore | NULL | NULL |
| 524 | klines | NULL | NULL |
| 608 | Uncle Don | 21617 | 2008-09-23 |
| 608 | Uncle Don | 21623 | 2008-09-23 |
| 687 | Lees Conner | NULL | NULL |
+----------+-------------------+-----------+------------+
10 rows in set (0.01 sec)
mysql> select Customer.Cust_Num,Cust_Name,Order_Num,Order_Date from Customer,Ord
ers;
+----------+-------------------+-----------+------------+
| Cust_Num | Cust_Name | Order_Num | Order_Date |
+----------+-------------------+-----------+------------+
| 148 | Hot Sports Center | 21608 | 2008-09-20 |
| 148 | Hot Sports Center | 21610 | 2008-09-20 |
| 148 | Hot Sports Center | 21613 | 2008-09-21 |
| 148 | Hot Sports Center | 21614 | 2008-09-21 |
| 148 | Hot Sports Center | 21617 | 2008-09-23 |
| 148 | Hot Sports Center | 21619 | 2008-09-23 |
| 148 | Hot Sports Center | 21623 | 2008-09-23 |
| 282 | Panas Direct | 21608 | 2008-09-20 |
| 282 | Panas Direct | 21610 | 2008-09-20 |
| 282 | Panas Direct | 21613 | 2008-09-21 |
| 282 | Panas Direct | 21614 | 2008-09-21 |
| 282 | Panas Direct | 21617 | 2008-09-23 |
| 282 | Panas Direct | 21619 | 2008-09-23 |
| 282 | Panas Direct | 21623 | 2008-09-23 |
| 356 | Fergusons | 21608 | 2008-09-20 |
| 356 | Fergusons | 21610 | 2008-09-20 |
| 356 | Fergusons | 21613 | 2008-09-21 |
| 356 | Fergusons | 21614 | 2008-09-21 |
| 356 | Fergusons | 21617 | 2008-09-23 |
| 356 | Fergusons | 21619 | 2008-09-23 |
| 356 | Fergusons | 21623 | 2008-09-23 |
| 408 | Everyone Corner | 21608 | 2008-09-20 |
| 408 | Everyone Corner | 21610 | 2008-09-20 |
| 408 | Everyone Corner | 21613 | 2008-09-21 |
| 408 | Everyone Corner | 21614 | 2008-09-21 |
| 408 | Everyone Corner | 21617 | 2008-09-23 |
| 408 | Everyone Corner | 21619 | 2008-09-23 |
| 408 | Everyone Corner | 21623 | 2008-09-23 |
| 462 | Bergains Galore | 21608 | 2008-09-20 |
| 462 | Bergains Galore | 21610 | 2008-09-20 |
| 462 | Bergains Galore | 21613 | 2008-09-21 |
| 462 | Bergains Galore | 21614 | 2008-09-21 |
| 462 | Bergains Galore | 21617 | 2008-09-23 |
| 462 | Bergains Galore | 21619 | 2008-09-23 |
| 462 | Bergains Galore | 21623 | 2008-09-23 |
| 524 | klines | 21608 | 2008-09-20 |
| 524 | klines | 21610 | 2008-09-20 |
| 524 | klines | 21613 | 2008-09-21 |
| 524 | klines | 21614 | 2008-09-21 |
| 524 | klines | 21617 | 2008-09-23 |
| 524 | klines | 21619 | 2008-09-23 |
| 524 | klines | 21623 | 2008-09-23 |
| 608 | Uncle Don | 21608 | 2008-09-20 |
| 608 | Uncle Don | 21610 | 2008-09-20 |
| 608 | Uncle Don | 21613 | 2008-09-21 |
| 608 | Uncle Don | 21614 | 2008-09-21 |
| 608 | Uncle Don | 21617 | 2008-09-23 |
| 608 | Uncle Don | 21619 | 2008-09-23 |
| 608 | Uncle Don | 21623 | 2008-09-23 |
| 687 | Lees Conner | 21608 | 2008-09-20 |
| 687 | Lees Conner | 21610 | 2008-09-20 |
| 687 | Lees Conner | 21613 | 2008-09-21 |
| 687 | Lees Conner | 21614 | 2008-09-21 |
| 687 | Lees Conner | 21617 | 2008-09-23 |
| 687 | Lees Conner | 21619 | 2008-09-23 |
| 687 | Lees Conner | 21623 | 2008-09-23 |
+----------+-------------------+-----------+------------+
56 rows in set (0.06 sec)
mysql> select Customer.Cust_Num,Cust_Name,Order_Num,Order_Date from Customer,Ord
ers ORDER BY Customer.Cust_Num;
+----------+-------------------+-----------+------------+
| Cust_Num | Cust_Name | Order_Num | Order_Date |
+----------+-------------------+-----------+------------+
| 148 | Hot Sports Center | 21608 | 2008-09-20 |
| 148 | Hot Sports Center | 21610 | 2008-09-20 |
| 148 | Hot Sports Center | 21613 | 2008-09-21 |
| 148 | Hot Sports Center | 21614 | 2008-09-21 |
| 148 | Hot Sports Center | 21617 | 2008-09-23 |
| 148 | Hot Sports Center | 21619 | 2008-09-23 |
| 148 | Hot Sports Center | 21623 | 2008-09-23 |
| 282 | Panas Direct | 21608 | 2008-09-20 |
| 282 | Panas Direct | 21610 | 2008-09-20 |
| 282 | Panas Direct | 21613 | 2008-09-21 |
| 282 | Panas Direct | 21614 | 2008-09-21 |
| 282 | Panas Direct | 21617 | 2008-09-23 |
| 282 | Panas Direct | 21619 | 2008-09-23 |
| 282 | Panas Direct | 21623 | 2008-09-23 |
| 356 | Fergusons | 21623 | 2008-09-23 |
| 356 | Fergusons | 21608 | 2008-09-20 |
| 356 | Fergusons | 21610 | 2008-09-20 |
| 356 | Fergusons | 21613 | 2008-09-21 |
| 356 | Fergusons | 21614 | 2008-09-21 |
| 356 | Fergusons | 21617 | 2008-09-23 |
| 356 | Fergusons | 21619 | 2008-09-23 |
| 408 | Everyone Corner | 21619 | 2008-09-23 |
| 408 | Everyone Corner | 21623 | 2008-09-23 |
| 408 | Everyone Corner | 21608 | 2008-09-20 |
| 408 | Everyone Corner | 21610 | 2008-09-20 |
| 408 | Everyone Corner | 21613 | 2008-09-21 |
| 408 | Everyone Corner | 21614 | 2008-09-21 |
| 408 | Everyone Corner | 21617 | 2008-09-23 |
| 462 | Bergains Galore | 21617 | 2008-09-23 |
| 462 | Bergains Galore | 21619 | 2008-09-23 |
| 462 | Bergains Galore | 21623 | 2008-09-23 |
| 462 | Bergains Galore | 21608 | 2008-09-20 |
| 462 | Bergains Galore | 21610 | 2008-09-20 |
| 462 | Bergains Galore | 21613 | 2008-09-21 |
| 462 | Bergains Galore | 21614 | 2008-09-21 |
| 524 | klines | 21614 | 2008-09-21 |
| 524 | klines | 21617 | 2008-09-23 |
| 524 | klines | 21619 | 2008-09-23 |
| 524 | klines | 21623 | 2008-09-23 |
| 524 | klines | 21608 | 2008-09-20 |
| 524 | klines | 21610 | 2008-09-20 |
| 524 | klines | 21613 | 2008-09-21 |
| 608 | Uncle Don | 21610 | 2008-09-20 |
| 608 | Uncle Don | 21613 | 2008-09-21 |
| 608 | Uncle Don | 21614 | 2008-09-21 |
| 608 | Uncle Don | 21617 | 2008-09-23 |
| 608 | Uncle Don | 21619 | 2008-09-23 |
| 608 | Uncle Don | 21623 | 2008-09-23 |
| 608 | Uncle Don | 21608 | 2008-09-20 |
| 687 | Lees Conner | 21608 | 2008-09-20 |
| 687 | Lees Conner | 21610 | 2008-09-20 |
| 687 | Lees Conner | 21613 | 2008-09-21 |
| 687 | Lees Conner | 21614 | 2008-09-21 |
| 687 | Lees Conner | 21617 | 2008-09-23 |
| 687 | Lees Conner | 21619 | 2008-09-23 |
| 687 | Lees Conner | 21623 | 2008-09-23 |
+----------+-------------------+-----------+------------+
56 rows in set (0.01 sec)
No comments:
Post a Comment