在SQL中,使用"JOIN"關(guān)鍵字可以將兩個表關(guān)聯(lián)起來。以下是一些常用的JOIN類型:
SELECT * FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;
SELECT * FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;
SELECT * FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.column_name;
SELECT * FROM table1
FULL JOIN table2
ON table1.column_name = table2.column_name;
可以根據(jù)具體的需求選擇適合的JOIN類型來實現(xiàn)表的關(guān)聯(lián)。