<commit_before>---
title: formatting
authors: emesika
wiki_title: OVirt-DB-Issues/formatting
wiki_revision_count: 29
wiki_last_updated: 2015-11-16
---

# formatting

The following SQL formatting rules apply to code written as views/SP/upgrade scripts under the dbscripts folder:

## Indentation

All indentations should use 4 spaces

## Capitalization

Keyword: UPPER
Data type: lower
Table name : lower
Column name : lower
Function name : InitCap for SP, lower for general functions that also must start with fn_db_
Column alias: lower
Variable : lower, starts with v_
Constraint: lower

## Comma option

Always after item

## AND/OR

Always in the end of line

## Select Query<commit_msg>AND/OR<commit_after>---
title: formatting
authors: emesika
wiki_title: OVirt-DB-Issues/formatting
wiki_revision_count: 29
wiki_last_updated: 2015-11-16
---

# formatting

The following SQL formatting rules apply to code written as views/SP/upgrade scripts under the dbscripts folder:

## Indentation

All indentations should use 4 spaces

## Capitalization

Keyword: UPPER
Data type: lower
Table name : lower
Column name : lower
Function name : InitCap for SP, lower for general functions that also must start with fn_db_
Column alias: lower
Variable : lower, starts with v_
Constraint: lower

## Comma option

Always after item

## AND/OR

Always in the end of line

## Operators

Always surround operators with one space

        Wrong:
        WHERE
            a+b=c
        Right:
        WHERE
            a + b = c

## Select Query
{'fraction_non_alphanumeric': 0.06348167539267016, 'fraction_numerical': 0.014397905759162303, 'mean_word_length': 3.763239875389408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3611476', 'n_tokens_mistral': 499, 'n_tokens_neox': 458, 'n_words': 186}