0
我有兩個查詢。他們是一樣的嗎?2個查詢的比較(MySQL)
DELETE FROM t1
USING t1
LEFT JOIN t2 using(key)
WHERE t2.key is null
DELETE t1
FROM t1
LEFT JOIN t2 using(key)
WHERE t2.key is null
如果是,哪一個更有效?
我有兩個查詢。他們是一樣的嗎?2個查詢的比較(MySQL)
DELETE FROM t1
USING t1
LEFT JOIN t2 using(key)
WHERE t2.key is null
DELETE t1
FROM t1
LEFT JOIN t2 using(key)
WHERE t2.key is null
如果是,哪一個更有效?
在我看來都是相同的,因爲我從這個語法知道:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]
多表語法:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
tbl_name[.*] [, tbl_name[.*]] ...
FROM table_references
[WHERE where_condition]
或者:
DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
FROM tbl_name[.*] [, tbl_name[.*]] ...
USING table_references
[WHERE where_condition]
至於大家關心哪些的他們更有效率?這取決於情況意味着何時何地我們正在使用這個。
第一個看起來不正確。沒有'JOIN'就不能有'USING'。 – Barmar 2014-12-04 10:10:32