_addr-an address for the record could be physical or intangible such asĪlways use uppercase for the reserved keywords. ![]() _size-the size of something such as a file size or clothing._date-denotes a column that contains the date of something._seq-contains a contiguous sequence of values._name-signifies a name such as first_name._num-denotes the field contains any kind of number._total-the total or sum of a collection of values._status-flag value or some other status of any type such as._id-a unique identifier such as a column that is a primary key.Use the correct suffix where appropriate. The following suffixes have a universal meaning ensuring the columns can be readĪnd understood easily from SQL code. Do not prefix with sp_ or any other such descriptive prefix or Hungarian.monitor_tally ) AS monitor_total FROM staff AS s Stored procedures ![]() For computed data ( SUM() or AVG()) use the name you would give it were it.Always include the AS keyword-makes it easier to read as it is explicit.If there is already a correlation with the same name then append a number.As a rule of thumb the correlation name should be the first letter of each word.Should relate in some way to the object or expression they are aliasing.Always use lowercase except where it may make sense not to such as proper nouns.Do not add a column with the same name as its table and vice versa.Where possible avoid simply using id as the primary identifier for the table.Rather than cars_mechanics prefer services. Avoid, where possible, concatenating two table names together to create the name.Never give a table the same name as one of its columns and vice versa.Do not prefix with tbl or any other such descriptive prefix or Hungarian.Use a collective name or, less ideally, a plural form.Avoid abbreviations and if you have to use them make sure they are commonly.Use underscores where you would naturally include a space in the name (first.Avoid the use of multiple consecutive underscores-these can be hard to read.Only use letters, numbers and underscores in names.Names must begin with a letter and may not end with an underscore.Unless you are using a multi-byte character set. Keep the length to a maximum of 30 bytes-in practice this is 30 characters.Ensure the name is unique and does not exist as a.Object-oriented design principles should not be applied to SQL or database.Portability (you may need to configure your SQL server to support this depending Quoted identifiers-if you must use them then stick to SQL-92 double quotes for.Staff instead of employees or people instead of individuals. Plurals-use the more natural collective term where possible instead.Descriptive prefixes or Hungarian notation such as sp_ or tbl. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |