Home >Database >Mysql Tutorial >SELECT 语句模式

SELECT 语句模式

WBOY
WBOYOriginal
2016-06-07 14:57:161115browse

SELECT命令其实很简单,也很常用,但代码阅读经常为coder造成困扰; 其实用一种标准格式书写可以减低困扰的强度 无 SELECT field1, field2, ...FROM table1 aJOIN table2 b on 1=1 AND join_condition1 AND join_condition2..WHERE 1=1AND filter_condition1A

SELECT 命令其实很简单,也很常用,但代码阅读经常为coder造成困扰;
其实用一种标准格式书写可以减低困扰的强度
SELECT
    field1,
    field2,
    ...
FROM table1 a
JOIN table2 b on 1=1
    AND join_condition1
    AND join_condition2
..
WHERE 1=1
AND filter_condition1
AND filter_condition1
AND (1=2
    or filter_condition_sub1
    or filter_condition_sub2
    )
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn