Hi
I have something to play with today, how much can I learn?
1. MySQL
-----subquery and Connection (ii)-----
----Sub-query
A subquery, which is a SELECT clause that appears within other SQL statements
Note: A subquery is nested inside a query and must always appear in parentheses; it can contain multiple keywords or conditions; the outer query can be select,insert,update,set or do
The return of a subquery, which can be a scalar, a row, a column, or a subquery
Can be divided into three categories: the use of comparison operators =,>=, etc.; Not in; EXIST
----Using comparison operators to implement subqueries
--
Mysql> SELECT goods_id,goods_name,goods_price from Tdb_goods WHERE goods_price>=5391.30;
The numbers here can be used without a tube, which is an average of the previous gains.
So if you want to directly get the result of this average participation, write it with a subquery
Mysql> Select Goods_id,goods_name,goods_price from Tdb_goods WHERE goods_price>=, select ROUND (AVG (Goods_price), 2) from Tdb_goods);
As you can see here, the subquery is in parentheses, using the >=
--
When a subquery returns multiple results, and the main query is less than that, you can SOME the ALL keyword with any
Where any is the same as some, it is good to satisfy one of them, specifically which one depends on what operator is (e.g. > is greater than the minimum value).
All requests to meet all return requirements
Usage is written in front of sub-query parentheses
----subquery raised by in or not
In fact, the in and =all operators are equivalent, not in and =! All equivalent
Usage is similar
----EXIST
Returns a Boolean value with very little
The above describes something-mysql today, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.