【正文】
連接操作性能。說明241。 非外連接查詢中,連接表在from子句中列出,并以逗號分隔;連接條件在where子句中列出,而不允許使用join … on 方式實(shí)現(xiàn)join。241。 外連接查詢中,可使用left join … on語法;外連接一律使用left join表示。241。 可以改寫為連接的子查詢禁止使用子查詢方式,而應(yīng)改寫為連接方式。示例241。 規(guī)范select col1, col2 from tbl1, tbl2 where = 。select col1, col2 from tbl1 left outer join tbl2 on = 。select col1, col2 from tbl1 left outer join tbl2 on = 。select col1 from tbl1,tbl2 where = 。select col1 from tbl1 left join tbl2 on = where is null。241。 非規(guī)范:select col1, col2 from tbl1 join tbl2 on = 。select col1 from tbl1 where col2 in (select col3 from tbl2)。select col1 from tbl1 where col2 not in (select col3 from tbl2)。. 分頁查詢說明241。 分頁查詢必須帶有唯一的排序條件,除非業(yè)務(wù)邏輯明確要求隨機(jī)展現(xiàn)數(shù)據(jù)。對于多表連接的分頁語句,如果過濾條件在單個表上,則先分頁,后連接。見示例241。 通過limit進(jìn)行分頁操作的時候,limit參數(shù)為start(起始記錄數(shù)),page_offset(每頁記錄數(shù))。示例241。 規(guī)范化用法:select , ,, from (select , from tbl1 t where = exporder by limit start, page_offerset) a,tbl2 bwhere = 。 應(yīng)用程序連接數(shù)據(jù)庫必須使用連接池。盡量不要使用memory引擎的表,除非能把握好對內(nèi)存表的控