在SQL中,使用"JOIN"關鍵字可以將兩個表關聯起來。以下是一些常用的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;
可以根據具體的需求選擇適合的JOIN類型來實現表的關聯。