时间:2021-07-01 10:21:17 帮助过:4人阅读
可以使用ANY,SOME,ALL对查询进行。
SELECT user_name,user_id,user_phone FROM users WHERE user_age >= ANY (SELECT ROUND(AVG(age),0) FROM users);
2.由[NOT] IN/EXIS产生
SELECT user_name,user_id,user_phone FROM users WHERE user_age >= NOT IN (SELECT ROUND(AVG(age),0) FROM users);
3.由INSERT......SELECT产生
CREATE TABLE tdb_goods_brands ( brand_id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, brand_name VARCHAR(40) NOT NULL ) SELECT brand_name FROM tdb_goods GROUP BY brand_name
UPDATE tdb_goods INNER JOIN tdb_goods_brands ON brand_name = brand_name SET brand_name = brand_id;
MySQL 子查询与连接操作笔记
标签: