Friday, September 26, 2014

hicheel

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database delgvvr;
Query OK, 1 row affected (0.00 sec)

mysql> use delgvvr;
Database changed
mysql> create table baraa(Code char(6), Name char(30), Price int(50), Country ch
ar(20), Height float(3), Number int(5));
Query OK, 0 rows affected (0.29 sec)

mysql> insert into baraa values('EB1010', 'Zuragt', '1500000', 'Japan', '5', '10
0');
Query OK, 1 row affected (0.07 sec)

mysql> insert into baraa values('EB1101', 'toos sorogch', '350000', 'China', '0.
5', '1000');
Query OK, 1 row affected (0.08 sec)

mysql> insert into baraa values('EB1212', 'us butsalgagch', '25000', 'China', '0
.5', '750');
Query OK, 1 row affected (0.09 sec)

mysql> insert into baraa values('PC1212', 'HP PC', '450000', 'Thailand', '5', '1
0');
Query OK, 1 row affected (0.05 sec)

mysql> insert into baraa values('PC1123', 'Acer PC', '500000', 'Korea', '5', '10
');
Query OK, 1 row affected (0.04 sec)

mysql> insert into baraa values('LP1010', 'Macbook pro', '1500000', 'USA', '2',
'10');
Query OK, 1 row affected (0.03 sec)

mysql> insert into baraa values('LP1211', 'Acer laptop', '1300000', 'Korea', '1'
, '10');
Query OK, 1 row affected (0.05 sec)

mysql> select * from baraa;
+--------+----------------+---------+----------+--------+--------+
| Code   | Name           | Price   | Country  | Height | Number |
+--------+----------------+---------+----------+--------+--------+
| EB1010 | Zuragt         | 1500000 | Japan    |      5 |    100 |
| EB1101 | toos sorogch   |  350000 | China    |    0.5 |   1000 |
| EB1212 | us butsalgagch |   25000 | China    |    0.5 |    750 |
| PC1212 | HP PC          |  450000 | Thailand |      5 |     10 |
| PC1123 | Acer PC        |  500000 | Korea    |      5 |     10 |
| LP1010 | Macbook pro    | 1500000 | USA      |      2 |     10 |
| LP1211 | Acer laptop    | 1300000 | Korea    |      1 |     10 |
+--------+----------------+---------+----------+--------+--------+
7 rows in set (0.00 sec)

mysql> select min(Price) from baraa;
+------------+
| min(Price) |
+------------+
|      25000 |
+------------+
1 row in set (0.00 sec)

mysql> select avg(Height) from baraa;
+--------------------+
| avg(Height)        |
+--------------------+
| 2.7142857142857144 |
+--------------------+
1 row in set (0.00 sec)

mysql> select sum(Height) from baraa;
+-------------+
| sum(Height) |
+-------------+
|          19 |
+-------------+
1 row in set (0.00 sec)

mysql> select * from baraa where Code like 'EB%';
+--------+----------------+---------+---------+--------+--------+
| Code   | Name           | Price   | Country | Height | Number |
+--------+----------------+---------+---------+--------+--------+
| EB1010 | Zuragt         | 1500000 | Japan   |      5 |    100 |
| EB1101 | toos sorogch   |  350000 | China   |    0.5 |   1000 |
| EB1212 | us butsalgagch |   25000 | China   |    0.5 |    750 |
+--------+----------------+---------+---------+--------+--------+
3 rows in set (0.00 sec)

mysql> select * from baraa where Code like '%10';
+--------+-------------+---------+---------+--------+--------+
| Code   | Name        | Price   | Country | Height | Number |
+--------+-------------+---------+---------+--------+--------+
| EB1010 | Zuragt      | 1500000 | Japan   |      5 |    100 |
| LP1010 | Macbook pro | 1500000 | USA     |      2 |     10 |
+--------+-------------+---------+---------+--------+--------+
2 rows in set (0.00 sec)

mysql>

No comments:

Post a Comment