亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Mysql ?? ??? ??, ??, ??

??? ???? ?? ???? ?? ??? ???? ??????. ? ????? ?? ??? ???? ?? ?? ??? ?????.

money?? ??? ??? ??????.

???? ???? ???? ??? ????.

CREATE TABLE money (
     id INT NOT NULL AUTO_INCREMENT ,
     username VARCHAR(50) NOT NULL ,
     balance FLOAT NOT NULL ,
     province VARCHAR(20) NOT NULL ,
     age TINYINT UNSIGNED NOT NULL ,
     sex TINYINT NOT NULL ,
     PRIMARY KEY (id(10))
) ENGINE = InnoDB CHARACTER SET utf8;

??? ??? ???? ??? ?? ?????:

idusernamebalanceprovinceagesex
1 ???? 120.02???291
2???260.23??40 0
3????150.86 Shandong40 1
4Jing Boran810Liaoning271
5Li Bingbing 20.15???? 430
6?? 313Shandong631
7Yang Mi123Beijing 300
8??? 456Beijing29 1
9Liu Yan23.4Hunan360
10Zhao Benshan3456??? 631
11王峰 34.32Beijing441
12Guo Degang 212Tianjin431

??:
balance? ??? ?????.
province? ??? ?????.

?? ??

Category??? ??
?? ??select * from table;
??? * from Money;
?? ?? ? ?? ???? ?? ??? ?? ?? ??

??: "*"? ?? ??? ???? ???? ?? ??????. ? ?? ?? ??? ?????.

mysql> select * from Money;
+----+---- ---- ---+---------+---------+-----+
| ??? | ?? |
+----+------------+----------+------------+--- ---+ -----+
| 120.02 | ??? | 40 | 1 |
| 810 | ??? | 20.15 | ?? 6 | | ?? | 30 | 456 | ?? | 36 | ??? | 1 |
| 34.32 | ??? 1 | --------+------ -----+------------+------+------+
12? ? ?? (0.00?)

?? ?? ??




????


??? ?? 語 ?? ?? ????? ?? ?? ID, ??? ??, ?? ??; ??? ??, ?? ?? ??
??

mysql> ID, ??? ??, ?? ??;
+----+----------+----------+
| ID |
+----+------------+
| 1 | ???? | 260.23 |
| ? ??? |
| 5 | ??? | 313 |
| 8 |
| 23.4 | 10 | ???? | 34.32 |
| 212 | ---+------- --+
??? 12? ?(0.00?)

???? ?? ???? ?? ?? ?? ?? ??




category

??? ??

+------+| 27 || | 63 || 30 || 36 || 44 |8?(0.00?)??? ?? whereselect field from Table where ??;
basic syntax afectax tail?? ??? ??? ??????; ??? ??? ?? ?? ?? ??;| 29 |
+---------+
??? ??
?? ??


Example

select * from Money where age = 29;



?? ??

?? ??? 29? ?? ??? ?????. ?? ???



mysql> ?? = 29? ??? * ??;
+----+----------+---------+--------- - +------+----+
| ??? | ?? |
+--------+--- - ----+--------+----+
| 1 | ???? 120.02 | ??? | | 456 | ??? | 29 | 1 |
+----+----------+--------+- - ---+------+
2? ??(0.00?)

where? ?? ? ?? ??

?? ?????? ?? ???? ?? ??? ?????. ?? ??? where ?? ??? ??? '='???.

?? >, <, >=, <=, !=;

symbolExplanation>>? ?? ?? ???? ??? ?? ????. ; <?? ?? >=?? ??? ?? <=?? ??? ?? !=??? = ??

?? ???

?? ??? or ? ?? ?? ???? ???? ?? ?? ?? ??? ??? ?? ????

SymbolExplan ationoror andand
?? ??? ?? ???????.

Type???? ??? * ? ID? <10?????? ??? 10?? ?? ID? ???? ??='Hubei'
mysql> '???';

+------+------------+---------+----------+------+----- +
| ??? | ?? | +------+------------+---------+----------+------+----- +
1 | ???? 120.02 | +------+------------+---------+----------+------+----- +
1?(0.00?)


?? ?? ??

Category??? ???? ???? ?? ???? ????? ?? ??? ?? ???? ????? ID, ??? ??, ?? ??;?? ???? ???? ID, ??? ??, ?? ??? ???? ??? ?? ?????? ??

??? ???? ???:

mysql> ?? ???? ????? ID, ??? ??, ?? ??;+----+------------+---------+
??? ??
asc????, ?? ??? ? ???(???)
desc ????, ?? ???? ?? ?? ? ?? ??? order by? ?????. ??? desc ? asc? ?? ??? ??????. desc? ???? ?????? ???? ?? ????, asc? ?????? ???? ?? ?????. ???? ?? ??? ???? ?????? ?????.
| ??? ?? |

+---------+---------+

| 10 | ???? | 810 |

| 8 | ?? | 260.23 |
| 1 | ???? | 11 | ?? | 23.4 |
| 20.15 | -+-- -------+
?? ? 12? ?(0.00?)

?? ?? ??

order by ??? ??? ?? ?? ?? ??? ? ? ??? ??? ?? ??? ??? ?????. ??? ????. ??? ?? ??? ?? ??? ?? ??? ?? ?? ??? ? ?? ?? ??? ?? ?????.




Category

??? ??


?? ??

????? ?? ?? ?? 1 ?? ??? ?? ??,... ...Field n desc|asc;?? ??

* ??: ? ?? ??? ?? ??? ???? ?? ??. ? ?? ?? ?? ??? ???? ????. ? ?? ? ?? ??? ???? ????. *

mysql> ?? ??, ?? ?????? ??? ??, ??? ??, ??? ?????.
+----+------------+---------+
| ??? | ?? |
+----+------------+---------+
10 | ???? | 4 | ??? 810 |
8 | 456 |
6 | ?? 313 |
2 | ??? 260.23 |
12 | ??? | 3 | ???? 150.86 |
7 |?? 123 |
1 | ???? 120.02 |
11 | ?? 34.32 |
9 | ??? | 5 | ??? 20.15 |
+----+------------+---------+
??? 12? ?(0.00?)


?? ?? ??

?? ?? ??? ?? ??? ?? ??? ?? ??? ????? ?? ???? ???? ?? ?? ?? ?????.

? id, ??? ??, ??? ?? desc, age asc? ?????? ??
?? ???? id, ??? ??, ?? ??? ???? ??? ?? ?????? ?????. ??? ?? ????? age? ???? ?????? ?????
??????? ???? ???? ???? ?? ??;Example ?? 5?? ID, ??? ??, ?? ??; ? ?? ?? 5?? ??? ??

mysql> ?? ?? 5?? * ??;
+----+------------+----------+---------- - +------+------+
| ??? | ?? |
+-------+--- - ----+----------+-----+
| 1 | ???? 120.02 | ? | ????? | 43 | 0 | ---+--- ---+
5? ??(0.00?)

?? ?? ?? ? ??


Category

??? ???? ???? ?? ?? ??? ??? ?? ??? ?? QuantityExampleselect id,username, Balance from Money order by Balance desc Limit 5;?? ?????? ??, ?? 5?? ??? ??? ??+----+------------+---------+| ??? | ??? ?? | ?? |+---------+---------+
mysql> ID, ??? ??, ????? ?? ?? ?? 5;
| 810 |

| 6 | ?? | 260.23 |
+-------+ ------ -+
5? ??(0.00?)

?? ?? ?? ??

0?? ???? 3?? ???? ???? ?????. ? ?? ????? 3? ???? ? ???? ????. 6?? ????? 4?? ???? ????? ??? ?? ????

?? ?? ?? ?? ??? ???? ???.

????

??? ??

??? ??

??: ? ?? ???? 0???.

mysql> ID, ??? ??, ?? ?? 0,3;
? ?????. +----+------------+---------+
| ??? | ?? |
+----+------------+---------+
1 | ???? 120.02 |
2 | ??? 260.23 |
3 | ???? 150.86 |
+----+------------+---------+
3? ?? (0.00?)

3??? 3? ? ???? ? ?????

mysql> ID, ??? ??, ?? ?? 3,3;
? ?????. +----+------------+---------+
| ??? | ?? |
+----+------------+---------+
4 | ??? 810 |
5 | ??? 20.15 |
6 | ?? 313 |
+----+------------+---------+
3? ??(0.00?)

? ????? ?? ?????? ???? ?????.
???? 10?? ???? ??? ??:

??? 1? ?? 0,10
??? 2? ?? 10,10
??? 3? ?? 20,10

?... ...

?? ?? ??

  1. ? ??? ?? ?? ??? ??? ?? ????
  2. ??? ????? ?? ?? ??? ???? ???? ??? ??????
  3. ???? ??? ?? ??? ?? ??? ??? ?? ????
  4. ?? ???? ??? ?? ??? ??? ?? ????

?? ????? ???? ? ?? ?? ??? ????.

?? ??????? ?? ?? ?? ???, ??
?? ?? 0, 3?? ID, ??? ??, ?? ?? ;
? ?? ????? ? ?? ???? ?????
?? ??
sumsum
count?? ??
max ???
min???
avgAverage

??: ?? ?? mysql ??? ??? ? ??? ?? ?? ????. ??? ?? ????? ???? ?? ?? ?? ?? ?????? ?? ???? ??? ?? ?? ?? ??? ??? ????. MySQL ??? ???? ?? ?? ??? ??? ??? ?? ?? ?? ??? ???? ??? ?? ??? ??? ??? ????.

??????? ??
?? ??select function(field) from table
Exampleselect count(id) from Money
?? ? ?? ???? ? ID ?? ?????

mysql> ??? ??(id) ??;
+----------+
| ??(ID) |
+----------+
12 |
+----------+
1? ??(0.00?)

??? ??? ??? ?? ????! as ???? ?????.

mysql> ??? ??? count(id)? ?????.
+---------+
|?? |
+---------+
12 |
+---------+
1? ??(0.00?)

?? ?? ??

mysql> ??? ??(??) ??;
+---------+
??(??) |
+---------+
498.24833393096924 |
+---------+
1? ??(0.00?)

?? ??

mysql> ??? ??(??) ??;
+------+
| ??(??) |
+------+
5978.980007171631 |
+------+
1? ??(0.00?)

?? ?? ??

mysql> ??? ??(??) ??;
+-------------+
|??(??) |
+-------------+
3456 |
+-------------+
1? ??(0.00?)

?? ?? ??

mysql> ??? ??(??) ??;
+---------+
|??(??) |
+---------+
20.149999618530273 |
+---------+
1? ??(0.00?)

group by

???? ??? ??? ???? ???? ? ?? ? ????. ??? ??? ?????. ?, ??? ?????. ???

?? ? ???? ???

mysql> ??? ?? ???? * ??;
+----+------------+---------+--------- -+----+------+
| ??? | ?? |
+------+--- ------+--------+-----+
| 7 | ??? 30 | Guo Degang | ?? | 0 |
| 4 | ??? | 20.15 | --------------+-- -------+------------+------+------+

??? ???(??) ? ?:

mysql> deptno ??, emp ???? deptno?? ??(1);
+---------+------------+
| ????(1) |

+-------+

| 1 | 1 |

| 5 | 4 |

+---------+--- -------+
4? ??(0.04?)

? ?? ?? ???? ?????


mysql> ??? ?? ???? ??(??), ?? ??;
+------+------------+
| ???(?) |
+------+------------+

3 | ??? |

| 1 1 | ?? |

3 |?? |
1 1 | |??? |

2 | ??? |
| ????? |
+------+------------+
7? ??(0.00?)


??? ??

??? ??? ??? ?? ???? ????. ? ?? ???? ?? ???? ?????.

?? ??? ???? ???? ??? ??? ?? ? ??? ???? ????.

Category??? ??
?? ??select * from table group by field with Rollup
Exampleselect count(province),province from Money Group by Province with ?? ;
?? ???? ?? ?? ??? ???

? ??? ??? ?? ?? ??? ?? ?? ?? ?? ?? 12?? NULL? ??? ????.

mysql> ??? ?? ??? ?? ???? ??(??) ??;
+------+------------+
| ???(?) |
+------+------------+
3 | ??? |
| 1 1 | ?? |
3 |?? |
1 1 | |??? |
2 | ??? |
| ????? |
12 |NULL |
+------+------------+
8? ??(0.00?)

?? ?? ??? ??????.

having ?? where? ????? ? ? ??? ???? ????.

having? ??? ???? ??? ??? ??? ????

Category??? ???? ??select * ????? ??? ?? ???? ???Examplecount(province)? ??? ?? ???? ? ???? >2;?? ???? ????? ??? ???? ??? ??? 2?? ? ???? ??? ?????

mysql> ??? count(province)? ????, ???? ? ???? ??? >2;
+---------+----------+
| ?? |
+---------+----------+
3 | ??? |
3 |?? |
+---------+----------+
2? ??(0.00?)

SQL ?? ????

? ???? ??? ?? ?? ?? ??????.

?? ?? ???? ? ? ?? ?????. ?? SQL ?? ???? ?? ??? ??? ????.

SELECT
[?? 1 [?? 1], [??(?? 2),]...?? n]
FROM ??? ??
[WHERE ?? ??]
[GROUP BY ??]
[HAVING where_continition]
[????]
[?? ??]

??: []? ? ??? ?? ??? ??? ? ????.

?? ??? ??? ?? ?????.

Keywords Description
selectSelected columns
fromtable
???? ??
group by?? ??? ??? ?? grouping ??
order bysort attribute
limit?? ??? ??, ??? ?? ????

????? ?????. , ?? ??? ??(id, ??? ??, ??, ??)? ?????. id>1?? ??? 50?? ?? ???. ????? ??? ?????. ?????? ??? ID? ????, 3?? ??? ????? ?????.

????? ??? ?? SQL ?? ???? ?? ??? ??? ????.

mysql> ?? 3;
+------+------------+---------+----------+
| ??? | ?? | +------+------------+---------+----------+
12 | ??? 212 | 7 | ?? | 4 | ??? 810 |
+------+------------+---------+----------+
3? ?? (0.00?)


???? ??

||
<?php echo "Hello Mysql"; ?>
<bdo id="z0p70"></bdo>

<nobr id="z0p70"><strong id="z0p70"><wbr id="z0p70"></wbr></strong></nobr>