Friday, September 26, 2014

22

,'1000');
Query OK, 1 row affected, 1 warning (0.03 sec)

mysql> insert into baraa values('EB1101', 'us butsal', '25000','China','0.5','75
0');
Query OK, 1 row affected, 1 warning (0.02 sec)

mysql> create table baraa1(code int(8), name char(50), price int(50),country cha
r(20), height float (20), number int (100));
Query OK, 0 rows affected (0.11 sec)

mysql> create table baraanuud(code char(8), name char(50), price int(50),country
 char(20), height float (20), number int (100));
Query OK, 0 rows affected (0.10 sec)

mysql> insert into baraanuud values('EB1010', 'Zuragt', '1500000','Yapon','5','1
00');
Query OK, 1 row affected (0.03 sec)

mysql> insert into baraanuud values('EB1101', 'Toos sorogch', '350000','China','
0.5','1000');
Query OK, 1 row affected (0.01 sec)

mysql> insert into baraanuud values('EB1101', 'us butsalgagch', '25000','China',
'0.5','750');
Query OK, 1 row affected (0.03 sec)

mysql> insert into baraanuud values('EB1212', 'us butsalgagch', '25000','China',
'0.5','750');
Query OK, 1 row affected (0.02 sec)

mysql> insert into baraanuud values('PC1212', 'HP PC', '450000','Tailand,'5','10
');
    '> insert into baraanuud values('PC1212', 'HP PC', '450000','Tailand,'5','10
');';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '5','1
0');
insert into baraanuud values('PC1212', 'HP PC', '450000','Tailand,'5',' at line
1
    '> ';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '';
'' at line 1
mysql> insert into baraanuud values('PC1212', 'HP PC', '450000','Tailand,'5','10
');
    '> ';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '5','1
0');
'' at line 1
mysql> insert into baraanuud values('PC1212', 'HP PC', '450000','Tailand','5','1
0');
Query OK, 1 row affected (0.01 sec)

mysql> insert into baraanuud values('PC1123', 'Acer PC', '500000','Korea','5','1
0');
Query OK, 1 row affected (0.01 sec)

mysql> insert into baraanuud values('LP1010', 'Macbook Pro', '1500000','U.S.A','
2','10');
Query OK, 1 row affected (0.03 sec)

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

mysql> select * from baraanuud;
+--------+----------------+---------+---------+--------+--------+
| code   | name           | price   | country | height | number |
+--------+----------------+---------+---------+--------+--------+
| EB1010 | Zuragt         | 1500000 | Yapon   |      5 |    100 |
| EB1101 | Toos sorogch   |  350000 | China   |    0.5 |   1000 |
| EB1101 | us butsalgagch |   25000 | China   |    0.5 |    750 |
| EB1212 | us butsalgagch |   25000 | China   |    0.5 |    750 |
| PC1212 | HP PC          |  450000 | Tailand |      5 |     10 |
| PC1123 | Acer PC        |  500000 | Korea   |      5 |     10 |
| LP1010 | Macbook Pro    | 1500000 | U.S.A   |      2 |     10 |
| LP1211 | Acer laptop    | 1300000 | Korea   |      1 |     10 |
+--------+----------------+---------+---------+--------+--------+
8 rows in set (0.12 sec)

mysql> select * from baraanuud where CODE like 'EB%' order by CODE asc;
+--------+----------------+---------+---------+--------+--------+
| code   | name           | price   | country | height | number |
+--------+----------------+---------+---------+--------+--------+
| EB1010 | Zuragt         | 1500000 | Yapon   |      5 |    100 |
| EB1101 | Toos sorogch   |  350000 | China   |    0.5 |   1000 |
| EB1101 | us butsalgagch |   25000 | China   |    0.5 |    750 |
| EB1212 | us butsalgagch |   25000 | China   |    0.5 |    750 |
+--------+----------------+---------+---------+--------+--------+
4 rows in set (0.04 sec)

mysql> select * from baraanuud where CODE like '%10%' order by CODE asc;
+--------+----------------+---------+---------+--------+--------+
| code   | name           | price   | country | height | number |
+--------+----------------+---------+---------+--------+--------+
| EB1010 | Zuragt         | 1500000 | Yapon   |      5 |    100 |
| EB1101 | Toos sorogch   |  350000 | China   |    0.5 |   1000 |
| EB1101 | us butsalgagch |   25000 | China   |    0.5 |    750 |
| LP1010 | Macbook Pro    | 1500000 | U.S.A   |      2 |     10 |
+--------+----------------+---------+---------+--------+--------+
4 rows in set (0.00 sec)

mysql> select * from baraanuud where CODE like '10%' order by CODE asc;
Empty set (0.00 sec)

mysql> select * from baraanuud where CODE like 'EB%10%' order by CODE asc;
+--------+----------------+---------+---------+--------+--------+
| code   | name           | price   | country | height | number |
+--------+----------------+---------+---------+--------+--------+
| EB1010 | Zuragt         | 1500000 | Yapon   |      5 |    100 |
| EB1101 | Toos sorogch   |  350000 | China   |    0.5 |   1000 |
| EB1101 | us butsalgagch |   25000 | China   |    0.5 |    750 |
+--------+----------------+---------+---------+--------+--------+
3 rows in set (0.00 sec)

mysql> select * from baraanuud where price>'1000000';
+--------+-------------+---------+---------+--------+--------+
| code   | name        | price   | country | height | number |
+--------+-------------+---------+---------+--------+--------+
| EB1010 | Zuragt      | 1500000 | Yapon   |      5 |    100 |
| LP1010 | Macbook Pro | 1500000 | U.S.A   |      2 |     10 |
| LP1211 | Acer laptop | 1300000 | Korea   |      1 |     10 |
+--------+-------------+---------+---------+--------+--------+
3 rows in set (0.02 sec)

mysql> select * from baraanuud where COUNTRY like 'korea'order by COUNTRY asc;
+--------+-------------+---------+---------+--------+--------+
| code   | name        | price   | country | height | number |
+--------+-------------+---------+---------+--------+--------+
| PC1123 | Acer PC     |  500000 | Korea   |      5 |     10 |
| LP1211 | Acer laptop | 1300000 | Korea   |      1 |     10 |
+--------+-------------+---------+---------+--------+--------+
2 rows in set (0.00 sec)

mysql> select sum (height) from baraanuud;
ERROR 1305 (42000): FUNCTION baraa.sum does not exist
mysql> select sum(height) from baraanuud;
+-------------+
| sum(height) |
+-------------+
|        19.5 |
+-------------+
1 row in set (0.17 sec)

mysql> select * from baraanuud where CODE like '%10' order by CODE asc;
+--------+-------------+---------+---------+--------+--------+
| code   | name        | price   | country | height | number |
+--------+-------------+---------+---------+--------+--------+
| EB1010 | Zuragt      | 1500000 | Yapon   |      5 |    100 |
| LP1010 | Macbook Pro | 1500000 | U.S.A   |      2 |     10 |
+--------+-------------+---------+---------+--------+--------+
2 rows in set (0.00 sec)

mysql> select sum(price) from baraanuud;
+------------+
| sum(price) |
+------------+
|    5650000 |
+------------+
1 row in set (0.02 sec)

mysql> select avg(price) from baraanuud;
+-------------+
| avg(price)  |
+-------------+
| 706250.0000 |
+-------------+
1 row in set (0.00 sec)

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

mysql> select * from baraanuud where price<'1000000';
+--------+----------------+--------+---------+--------+--------+
| code   | name           | price  | country | height | number |
+--------+----------------+--------+---------+--------+--------+
| EB1101 | Toos sorogch   | 350000 | China   |    0.5 |   1000 |
| EB1101 | us butsalgagch |  25000 | China   |    0.5 |    750 |
| EB1212 | us butsalgagch |  25000 | China   |    0.5 |    750 |
| PC1212 | HP PC          | 450000 | Tailand |      5 |     10 |
| PC1123 | Acer PC        | 500000 | Korea   |      5 |     10 |
+--------+----------------+--------+---------+--------+--------+
5 rows in set (0.00 sec)

mysql> select * from baraanuud where price 3500000x100'';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '35000
00x100''' at line 1
mysql> select * from baraanuud where price'1000000*10';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ''1000
000*10'' at line 1
mysql> select * from baraanuud where price='1000000*10';
Empty set, 8 warnings (0.00 sec)

mysql> select * from baraanuud price='1000000*10';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '='100
0000*10'' at line 1
mysql> select price*number from baraanuud;
+--------------+
| price*number |
+--------------+
|    150000000 |
|    350000000 |
|     18750000 |
|     18750000 |
|      4500000 |
|      5000000 |
|     15000000 |
|     13000000 |
+--------------+
8 rows in set (0.04 sec)

mysql>
mysql> select name.zuragt price*number from baraanuud;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '*numb
er from baraanuud' at line 1
mysql> select (price*number) from baraanuud where name like 'zuragt';
+----------------+
| (price*number) |
+----------------+
|      150000000 |
+----------------+
1 row in set (0.01 sec)

mysql> select (height*number) from baraanuud where name like 'zuragt';
+-----------------+
| (height*number) |
+-----------------+
|             500 |
+-----------------+
1 row in set (0.00 sec)

mysql> select (height*number) and (price*number) from baraanuud where name like
'zuragt';
+------------------------------------+
| (height*number) and (price*number) |
+------------------------------------+
|                                  1 |
+------------------------------------+
1 row in set (0.01 sec)

mysql> select (height*number),(price*number) from baraanuud where name like 'zur
agt';
+-----------------+----------------+
| (height*number) | (price*number) |
+-----------------+----------------+
|             500 |      150000000 |
+-----------------+----------------+
1 row in set (0.00 sec)

mysql> select * from baraanuud where CODE like 'EB%10' order by CODE asc;
+--------+--------+---------+---------+--------+--------+
| code   | name   | price   | country | height | number |
+--------+--------+---------+---------+--------+--------+
| EB1010 | Zuragt | 1500000 | Yapon   |      5 |    100 |
+--------+--------+---------+---------+--------+--------+
1 row in set (0.00 sec)

mysql> select * from baraanuud where CODE like '%10%' order by CODE asc;
+--------+----------------+---------+---------+--------+--------+
| code   | name           | price   | country | height | number |
+--------+----------------+---------+---------+--------+--------+
| EB1010 | Zuragt         | 1500000 | Yapon   |      5 |    100 |
| EB1101 | Toos sorogch   |  350000 | China   |    0.5 |   1000 |
| EB1101 | us butsalgagch |   25000 | China   |    0.5 |    750 |
| LP1010 | Macbook Pro    | 1500000 | U.S.A   |      2 |     10 |
+--------+----------------+---------+---------+--------+--------+
4 rows in set (0.00 sec)

mysql> select * from baraanuud where CODE like '%10' order by CODE asc;
+--------+-------------+---------+---------+--------+--------+
| code   | name        | price   | country | height | number |
+--------+-------------+---------+---------+--------+--------+
| EB1010 | Zuragt      | 1500000 | Yapon   |      5 |    100 |
| LP1010 | Macbook Pro | 1500000 | U.S.A   |      2 |     10 |
+--------+-------------+---------+---------+--------+--------+
2 rows in set (0.00 sec)

mysql> select * from baraanuud where CODE like '%10%' order by CODE asc;
+--------+----------------+---------+---------+--------+--------+
| code   | name           | price   | country | height | number |
+--------+----------------+---------+---------+--------+--------+
| EB1010 | Zuragt         | 1500000 | Yapon   |      5 |    100 |
| EB1101 | Toos sorogch   |  350000 | China   |    0.5 |   1000 |
| EB1101 | us butsalgagch |   25000 | China   |    0.5 |    750 |
| LP1010 | Macbook Pro    | 1500000 | U.S.A   |      2 |     10 |
+--------+----------------+---------+---------+--------+--------+
4 rows in set (0.00 sec)

mysql> select * from baraanuud where CODE like '' order by CODE asc;

No comments:

Post a Comment