5 | 2012-12-06 | 3 | undaa |
| 6 | pepsi-500ml | 3 | 750 | 300 | 6 |
5 | 2012-12-06 | 1 | gurilan bvt |
| 6 | pepsi-500ml | 3 | 750 | 300 | 6 |
5 | 2012-12-06 | 2 | zairmag |
| 6 | pepsi-500ml | 3 | 750 | 300 | 6 |
5 | 2012-12-06 | 3 | undaa |
| 7 | cocacola-330ml | 3 | 100 | 500 | 6 |
5 | 2012-12-06 | 1 | gurilan bvt |
| 7 | cocacola-330ml | 3 | 100 | 500 | 6 |
5 | 2012-12-06 | 2 | zairmag |
| 7 | cocacola-330ml | 3 | 100 | 500 | 6 |
5 | 2012-12-06 | 3 | undaa |
| 1 | atar talh | 1 | 650 | 100 | 3 |
6 | 2012-12-06 | 1 | gurilan bvt |
| 1 | atar talh | 1 | 650 | 100 | 3 |
6 | 2012-12-06 | 2 | zairmag |
| 1 | atar talh | 1 | 650 | 100 | 3 |
6 | 2012-12-06 | 3 | undaa |
| 2 | zuiwan chex | 1 | 830 | 100 | 3 |
6 | 2012-12-06 | 1 | gurilan bvt |
| 2 | zuiwan chex | 1 | 830 | 100 | 3 |
6 | 2012-12-06 | 2 | zairmag |
| 2 | zuiwan chex | 1 | 830 | 100 | 3 |
6 | 2012-12-06 | 3 | undaa |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 3 |
6 | 2012-12-06 | 1 | gurilan bvt |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 3 |
6 | 2012-12-06 | 2 | zairmag |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 3 |
6 | 2012-12-06 | 3 | undaa |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 3 |
6 | 2012-12-06 | 1 | gurilan bvt |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 3 |
6 | 2012-12-06 | 2 | zairmag |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 3 |
6 | 2012-12-06 | 3 | undaa |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 3 |
6 | 2012-12-06 | 1 | gurilan bvt |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 3 |
6 | 2012-12-06 | 2 | zairmag |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 3 |
6 | 2012-12-06 | 3 | undaa |
| 6 | pepsi-500ml | 3 | 750 | 300 | 3 |
6 | 2012-12-06 | 1 | gurilan bvt |
| 6 | pepsi-500ml | 3 | 750 | 300 | 3 |
6 | 2012-12-06 | 2 | zairmag |
| 6 | pepsi-500ml | 3 | 750 | 300 | 3 |
6 | 2012-12-06 | 3 | undaa |
| 7 | cocacola-330ml | 3 | 100 | 500 | 3 |
6 | 2012-12-06 | 1 | gurilan bvt |
| 7 | cocacola-330ml | 3 | 100 | 500 | 3 |
6 | 2012-12-06 | 2 | zairmag |
| 7 | cocacola-330ml | 3 | 100 | 500 | 3 |
6 | 2012-12-06 | 3 | undaa |
| 1 | atar talh | 1 | 650 | 100 | 5 |
12 | 2012-12-05 | 1 | gurilan bvt |
| 1 | atar talh | 1 | 650 | 100 | 5 |
12 | 2012-12-05 | 2 | zairmag |
| 1 | atar talh | 1 | 650 | 100 | 5 |
12 | 2012-12-05 | 3 | undaa |
| 2 | zuiwan chex | 1 | 830 | 100 | 5 |
12 | 2012-12-05 | 1 | gurilan bvt |
| 2 | zuiwan chex | 1 | 830 | 100 | 5 |
12 | 2012-12-05 | 2 | zairmag |
| 2 | zuiwan chex | 1 | 830 | 100 | 5 |
12 | 2012-12-05 | 3 | undaa |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 5 |
12 | 2012-12-05 | 1 | gurilan bvt |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 5 |
12 | 2012-12-05 | 2 | zairmag |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 5 |
12 | 2012-12-05 | 3 | undaa |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 5 |
12 | 2012-12-05 | 1 | gurilan bvt |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 5 |
12 | 2012-12-05 | 2 | zairmag |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 5 |
12 | 2012-12-05 | 3 | undaa |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 5 |
12 | 2012-12-05 | 1 | gurilan bvt |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 5 |
12 | 2012-12-05 | 2 | zairmag |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 5 |
12 | 2012-12-05 | 3 | undaa |
| 6 | pepsi-500ml | 3 | 750 | 300 | 5 |
12 | 2012-12-05 | 1 | gurilan bvt |
| 6 | pepsi-500ml | 3 | 750 | 300 | 5 |
12 | 2012-12-05 | 2 | zairmag |
| 6 | pepsi-500ml | 3 | 750 | 300 | 5 |
12 | 2012-12-05 | 3 | undaa |
| 7 | cocacola-330ml | 3 | 100 | 500 | 5 |
12 | 2012-12-05 | 1 | gurilan bvt |
| 7 | cocacola-330ml | 3 | 100 | 500 | 5 |
12 | 2012-12-05 | 2 | zairmag |
| 7 | cocacola-330ml | 3 | 100 | 500 | 5 |
12 | 2012-12-05 | 3 | undaa |
| 1 | atar talh | 1 | 650 | 100 | 5 |
1 | 2012-12-05 | 1 | gurilan bvt |
| 1 | atar talh | 1 | 650 | 100 | 5 |
1 | 2012-12-05 | 2 | zairmag |
| 1 | atar talh | 1 | 650 | 100 | 5 |
1 | 2012-12-05 | 3 | undaa |
| 2 | zuiwan chex | 1 | 830 | 100 | 5 |
1 | 2012-12-05 | 1 | gurilan bvt |
| 2 | zuiwan chex | 1 | 830 | 100 | 5 |
1 | 2012-12-05 | 2 | zairmag |
| 2 | zuiwan chex | 1 | 830 | 100 | 5 |
1 | 2012-12-05 | 3 | undaa |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 5 |
1 | 2012-12-05 | 1 | gurilan bvt |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 5 |
1 | 2012-12-05 | 2 | zairmag |
| 3 | ogooj-eeven | 1 | 2200 | 25 | 5 |
1 | 2012-12-05 | 3 | undaa |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 5 |
1 | 2012-12-05 | 1 | gurilan bvt |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 5 |
1 | 2012-12-05 | 2 | zairmag |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 | 5 |
1 | 2012-12-05 | 3 | undaa |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 5 |
1 | 2012-12-05 | 1 | gurilan bvt |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 5 |
1 | 2012-12-05 | 2 | zairmag |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 | 5 |
1 | 2012-12-05 | 3 | undaa |
| 6 | pepsi-500ml | 3 | 750 | 300 | 5 |
1 | 2012-12-05 | 1 | gurilan bvt |
| 6 | pepsi-500ml | 3 | 750 | 300 | 5 |
1 | 2012-12-05 | 2 | zairmag |
| 6 | pepsi-500ml | 3 | 750 | 300 | 5 |
1 | 2012-12-05 | 3 | undaa |
| 7 | cocacola-330ml | 3 | 100 | 500 | 5 |
1 | 2012-12-05 | 1 | gurilan bvt |
| 7 | cocacola-330ml | 3 | 100 | 500 | 5 |
1 | 2012-12-05 | 2 | zairmag |
| 7 | cocacola-330ml | 3 | 100 | 500 | 5 |
1 | 2012-12-05 | 3 | undaa |
+------+-----------------------------+------+------------+-------+----------+---
----+------------+------+-------------+
168 rows in set (0.00 sec)
mysql> select * from baraa;
+------+-----------------------------+------+------------+-------+
| DD | Name | Type | Unit_Price | Piece |
+------+-----------------------------+------+------------+-------+
| 1 | atar talh | 1 | 650 | 100 |
| 2 | zuiwan chex | 1 | 830 | 100 |
| 3 | ogooj-eeven | 1 | 2200 | 25 |
| 4 | alyaska zairmag-shokolodtai | 2 | 300 | 250 |
| 5 | alyaska zairmag-tsotsgiitei | 2 | 300 | 200 |
| 6 | pepsi-500ml | 3 | 750 | 300 |
| 7 | cocacola-330ml | 3 | 100 | 500 |
+------+-----------------------------+------+------------+-------+
7 rows in set (0.00 sec)
mysql> select * from trade;
+----------+-------+------------+
| Baraa_DD | Piece | Ognoo |
+----------+-------+------------+
| 1 | 3 | 2012-11-30 |
| 2 | 3 | 2012-12-03 |
| 1 | 1 | 2012-12-04 |
| 4 | 10 | 2012-12-05 |
| 6 | 5 | 2012-12-06 |
| 3 | 6 | 2012-12-06 |
| 5 | 12 | 2012-12-05 |
| 5 | 1 | 2012-12-05 |
+----------+-------+------------+
8 rows in set (0.00 sec)
mysql> select * from type;
+------+-------------+
| ID | Name |
+------+-------------+
| 1 | gurilan bvt |
| 2 | zairmag |
| 3 | undaa |
+------+-------------+
3 rows in set (0.00 sec)
mysql> alter table type add primary key(ID);
Query OK, 3 rows affected (0.82 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> alter table baraa add foreign key(Type) references type(ID);
Query OK, 7 rows affected (8.26 sec)
Records: 7 Duplicates: 0 Warnings: 0
mysql> alter table trade add foreign key(Baraa_DD) references type(ID);
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint f
ails (`supermarket`.`#sql-1374_1`, CONSTRAINT `#sql-1374_1_ibfk_1` FOREIGN KEY (
`Baraa_DD`) REFERENCES `type` (`ID`))
mysql> alter table baraa add primary key(DD);
Query OK, 7 rows affected (0.88 sec)
Records: 7 Duplicates: 0 Warnings: 0
mysql> alter table trade add foreign key(Baraa_DD) references baraa(DD);
Query OK, 8 rows affected (0.78 sec)
Records: 8 Duplicates: 0 Warnings: 0
mysql> select * from baraa where Unit_Price>300;
+----+-------------+------+------------+-------+
| DD | Name | Type | Unit_Price | Piece |
+----+-------------+------+------------+-------+
| 1 | atar talh | 1 | 650 | 100 |
| 2 | zuiwan chex | 1 | 830 | 100 |
| 3 | ogooj-eeven | 1 | 2200 | 25 |
| 6 | pepsi-500ml | 3 | 750 | 300 |
+----+-------------+------+------------+-------+
4 rows in set (0.00 sec)
mysql> select baraa.Name,trade.Piece from baraa,trade where baraa.DD=trade.Baraa
.DD where Piece>5;
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 'where
Piece>5' at line 1
mysql> select baraa.Name,trade.Piece from baraa,trade where baraa.DD=trade.Baraa
.DD and where Piece>5;
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 'where
Piece>5' at line 1
mysql> select baraa.Name,trade.Piece from baraa,trade where baraa.DD=trade.Baraa
.DD;
ERROR 1054 (42S22): Unknown column 'trade.Baraa.DD' in 'where clause'
mysql> select baraa.Name,trade.Piece from baraa,trade where baraa.DD=trade.Baraa
_DD and where Piece>5;
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 'where
Piece>5' at line 1
mysql> select baraa.Name,trade.Piece from baraa,trade where baraa.DD=trade.Baraa
_DD where trade.Piece>5;
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 'where
trade.Piece>5' at line 1
mysql> select baraa.Name,trade.Piece from baraa,trade where baraa.DD=trade.Baraa
_DD;
+-----------------------------+-------+
| Name | Piece |
+-----------------------------+-------+
| atar talh | 3 |
| atar talh | 1 |
| zuiwan chex | 3 |
| ogooj-eeven | 6 |
| alyaska zairmag-shokolodtai | 10 |
| alyaska zairmag-tsotsgiitei | 12 |
| alyaska zairmag-tsotsgiitei | 1 |
| pepsi-500ml | 5 |
+-----------------------------+-------+
8 rows in set (0.00 sec)
mysql> select baraa.Name,trade.Piece from baraa,trade where baraa.DD=trade.Baraa
_DD where trade.Piece>5;
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 'where
trade.Piece>5' at line 1
mysql> select baraa.Name,trade.Piece from baraa,trade where baraa.DD=trade.Baraa
_DD and trade.Piece>5;
+-----------------------------+-------+
| Name | Piece |
+-----------------------------+-------+
| ogooj-eeven | 6 |
| alyaska zairmag-shokolodtai | 10 |
| alyaska zairmag-tsotsgiitei | 12 |
+-----------------------------+-------+
3 rows in set (0.00 sec)
mysql> select sum(Piece) from trade;
+------------+
| sum(Piece) |
+------------+
| 41 |
+------------+
1 row in set (0.00 sec)
mysql> select sum(Piece) from baraa;
+------------+
| sum(Piece) |
+------------+
| 1475 |
+------------+
1 row in set (0.00 sec)
mysql> select * from baraa where trade>'2012.12.03';
ERROR 1054 (42S22): Unknown column 'trade' in 'where clause'
mysql> select * from trade where ognoo>'2012.12.03';
+----------+-------+------------+
| Baraa_DD | Piece | Ognoo |
+----------+-------+------------+
| 1 | 1 | 2012-12-04 |
| 4 | 10 | 2012-12-05 |
| 6 | 5 | 2012-12-06 |
| 3 | 6 | 2012-12-06 |
| 5 | 12 | 2012-12-05 |
| 5 | 1 | 2012-12-05 |
+----------+-------+------------+
6 rows in set (0.00 sec)
mysql>
No comments:
Post a Comment