MySQL database connection query (multi-table queries)

A left outer link Dian (corresponding to the right of the table automatically fill the field null)

SELECT * FROM product_type LEFT JOIN product ON product_type.protype_id=product.protype_id;

 

Dian two right outer link (corresponding to the left table automatically fill the field null)

SELECT * FROM product RIGHT JOIN product_type ON product_type.protype_id=product.protype_id;

 

Wed and full outer connector (mutually corresponding fields, complement null) does not support

SELECT * FROM product full JOIN product_type ON product_type.protype_id=product.protype_id;

 

Four Dian join queries: sub-queries (where ... in ...)

SELECT * FROM product WHERE protype_id IN (SELECT protype_id FROM product_type WHERE protype_name='手机数码');

Guess you like

Origin www.cnblogs.com/0826sw/p/12014848.html