There is a connection operation between the SQL statements, which must be used in some complex data operations. Simply put, the result of an SQL statement can be part of a connected SQL operation. SQL Structured query statements, subqueries refer to all SQL operations, not a single SELECT statement.
1. Generated by comparison operators:
SELECT user_name,user_idfromWHERE>=(SELECTROUND( AVG (age),0 from users);
You can use Any,some,all to make queries.
SELECT user_name,user_idfromWHERE>= any (SELECT ROUND(AVG(age),0 from users);
2. Generated by [NOT] In/exis
SELECT user_name,user_idfromWHERE>= not in (SELECT ROUND(AVG(age),0 from users);
3. By insert ... Select generates
create table Tdb_goods_brands (brand_id smallint UNSIGNED primary Auto_increment, brand_name varchar (40 ) not null ) select brand_name from tdb_ Goods group by brand_name
UPDATE tdb_goods INNERJOINon=SET= brand_id;
MySQL subquery and connection operation notes