Today's course, the teacher mainly describes the DML statements in the Modification Data, table association and delete data and other related content, as well as PHP connection to MySQL database knowledge.
First, summary
1. Modify the data (be sure to add a where condition, otherwise all values in the field will change)
<1> modify the data in a table. Statement: UPDATE table name SET field name = value, field name = value where condition;
<2> modify data in multiple tables. Statement: UPDATE table name 1 as alias 1, table name 2 as alias 2 SET alias 1. Field name = value, alias 2. Field name = value WHERE condition;
2. Multi-Table Association. Statement: SELECT table name 1. field name, table Name 2. Field name .... from table name 1 [left/right]join table name 2 on condition [where condition] .
<1> Left Association: "A Ieft join B". Take the output A as the main, then output the B content related to a, put on the right side of A;
<2> right-associative: "A to join B". Take the output B as the main, and then output a content related to B, on the right side of B;
<3> in association: "A Join B". The part that is associated with the output A and B.
3. Fuzzy Search
<1> uses "%" to search, which represents more than one character. Statement: SELECT * FROM table name WHERE field name like "Yang%"; ("Yang%" stands for all values in the search field value with "Yang")
<2> searches with "_", which represents a character. Statement: SELECT * FROM table name WHERE field name like "Yang _ Yi";
("Yang%" means all values of the search field value "Yang (one character) meaning")
4. Delete the data. Statement: Delete from table name WHERE condition; (Be sure to add a where condition, otherwise the table is all deleted)
5. Use the aggregate function query. Statement: SELECT aggregate function from table name; aggregate function includes: count (field): Total Query field value, Max (field): Query maximum value in field, min (field): Query minimum value in field value, CVG (field): Query field value mean.
6. Group queries. Statement: SELECT * from table name Group By field name; (Field names are divided in one group)
7.php connecting PHP functions used in MySQL database
<1> Connection database: $a = mysql_connect (server host address, database user name, database password);
<2> Select and use database: mysql_select_db (self-built database name, $a);
Data in the <3> output data table: mysql_fetch_array ($result (data table already queried), [Mysql_assoc/mysql_num/mysql_both, not write default Mysql_both]);
<4> Other operating uses: mysql_query ($yuju, $a);
Second, PHP connection MySQL database used by the PHP function related rules
650) this.width=650; "title=" 1230.png "src=" http://s3.51cto.com/wyfs02/M01/8C/4A/ Wkiol1hpzpfri8c3aamhtprz880564.png-wh_500x0-wm_3-wmp_4-s_2358802736.png "alt=" Wkiol1hpzpfri8c3aamhtprz880564.png-wh_50 "/>
This article is from the "12244280" blog, please be sure to keep this source http://12254280.blog.51cto.com/12244280/1888230
PHP Course Summary 20161229