Database brief review

1, WHERE y_name LIKE '%% Li', containing long y_name "Li" on the line;% represents the obscured position.
'Lee%' represented in fields that begin with 'Lee', '% Li' expressed 'Lee' end of the field.
2, paging query: SELECT * FROM yingxiong LIMIT 3,2 represent two records display records from the beginning of Article 3 of the record.
SELECT * FROM yingxiong LIMIT 4 indicating the start recording from the display 4 0.
3, alias: SELECT y_name AS name YingXiong the FROM
. 4, selecting the maximum value: SELECT max (y_age) FROM yingxiong , 100 obtained.
5, the sub condition with multiple records query: with in the plurality of records loaded up, the SELECT * the FROM YingXiong
the WHERE y_age in (the SELECT y_age the FROM YingXiong the WHERE y_type = 'single')
6, group functions: SELECT y_type, SUM ( y_age) FROM yingxiong gROUP BY y_type, according to a field grouping, and the sum of age groups.
Conditions with HAVING keyword grouping function (specific packet), the SELECT y_type, the SUM (y_age) the FROM YingXiong the GROUP BY y_type the HAVING the SUM (y_age)> 50
. 7, left connection: the SELECT * the FROM Wanjia the LEFT the JOIN YingXiong
the ON wanjia.shouxuan = YingXiong .y_type
8, the connection: the SELECT * the FROM Wanjia the INNER the JOIN YingXiong
the ON wanjia.shouxuan = yingxiong.y_type, while matching the data showing the scale, if there is no data on either side of, the filter.
9, null query:
WHERE condition = '', no value.
where conditions = 'null', is null.
where is null, the default null value.
10, the new statement: INSERT INTO wanjia (id, NAME , birthday) VALUES ( ' feng', '17 ',' 1234-5-6 ')
11, modification statement: UPDATE wanjia SET `name` =' tiger '
the WHERE ID =' 005 '

Guess you like

Origin www.cnblogs.com/two-peanuts/p/11203379.html