| Goal | Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming. |
|---|---|
| Notes | The query works somewhat correctly only if the names are in Estoniand. The query is based on a simplified assumption that in case of many words in Estonian (of course, not all) the plural form is indicated by the letter "d" at the end of the word. If the name or its subcomponent ends with de_ or te_, then it is considered plural. Names that for example end with id, oid, kood, or uuid are considered singular. Thus, "auto" is considered singular whereas "autod" and "autode_aruanne" are considered plural. The query tries to give suggestions whether the column name should be in singular or plural form. For that it also considers the type of the column. For instance, array, xml, and json values can contain data about multiple entities or relationships and thus the name of the column that has the type should better be in plural. The names of colums with a numeric type are considered OK even if they are in plural because it is assumed that the value shows the number of entities. Thus, kaubad with type INT is considered to be plural and OK whereas kommentaarid with type TEXT is considered to be plural and not OK. |
| Type | General (Overview of some aspect of the database.) |
| License | MIT (opens in new tab) |
| Fixing Suggestion | Prefer singular form. Plural form may indicate that there should be a separate table instead of the column. |
| Data Source | INFORMATION_SCHEMA+system catalog |
| SQL Query |
|
Categories
This query is classified under the following categories:
Inconsistencies
Queries of this catergory provide information about inconsistencies of solving the same problem in different places.
Naming
Queries of this category provide information about the style of naming.
| Name | Description |
|---|---|
| Inconsistencies | Queries of this catergory provide information about inconsistencies of solving the same problem in different places. |
| Naming | Queries of this category provide information about the style of naming. |
Further reading and related materials:
Linguistic antipatterns "D.1 Says one but contains many" and "E.1 Says many but contains one": Arnaoudova, V., Di Penta, M., Antoniol, G., 2016. Linguistic antipatterns: What they are and how developers perceive them. Empirical Software Engineering, 21(1), pp.104-158.
| Reference |
|---|
| Linguistic antipatterns "D.1 Says one but contains many" and "E.1 Says many but contains one": Arnaoudova, V., Di Penta, M., Antoniol, G., 2016. Linguistic antipatterns: What they are and how developers perceive them. Empirical Software Engineering, 21(1), pp.104-158. |