SQL 1:
SELECT
a.*,
b.name
FROM
t_coach a
LEFT JOIN t_school b on a.school_id=b.id
SQL 2:
SELECT a.*, (select b.name FROM t_school b WHERE b.id= a.school_id) AS name FROM t_coach a
SQL1和SQL2得到結果是一樣的。
在實際開發中第二種SQL 可以這樣寫嗎?
相對於SQL1 ,SQL2的效率是不是低?