Skip to content
logo
Percona Documentation Style Guide
SQL statement conventions
Initializing search
    percona/doc-style-guide
    percona/doc-style-guide
    • Home
    • Storytelling
      • Voice and Tone
      • Keep the Structure Simple
      • Use Cross-References Appropriately
    • Text
      • Hyphens
      • Paragraphs
      • Lists
      • Headings
      • Tables
      • Graphics
      • Callouts and admonitions
      • Code descriptions
      • SQL statement conventions
        • Examples
      • Links
      • Legal information
      • None
    • Grammar
      • Capitalization
      • Punctuation
      • Spelling
      • Word usage
      • Numbers
    • Writing
      • Rules for specific documentation types
    • Guidelines
    • Markup
    • Copyright and licensing
    • Trademark policy
    • Examples

    SQL statement conventions¶

    SQL commands should be written in uppercase letters. This convention lets the user identify the keywords SQL statement keywords and easily parse the statement. The statements can be single line or multiline. If the statement is multiline, format each column or logical statement on a new line, the statement to identify what is being queried and filtered. SQL keywords should be on their own line and indent the criteria.

    Examples¶

    Single line

    Incorrect

    select e.first-name, e.last-name, s.salary from employees e inner join salary s on e.employeeid=s.employeeid 
    

    Correct

    SELECT e.first-name, e.last-name, s.salary FROM employees e INNER JOIN salary s ON e.employeeid=s.employeeid
    

    Multiline

    Incorrect

    select e.first-name, e.last-name, s.salary from employees e inner join salary s 
    on e.employeeid=s.employeeid 
    

    Correct

    SELECT
        e.first-name,
        e.last-name,
        s.salary
    FROM
        employees e
        INNER JOIN salary s ON e.employeeid=s.employeeid
    

    Contact Us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.


    Last update: June 26, 2023
    Created: June 26, 2023
    Percona LLC and/or its affiliates, © 2023
    Made with Material for MkDocs

    Cookie consent

    We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better. Read more about Percona Cookie Policy.