| Goal | Find implementations of state machines that uses a set of columns with a timestamp type. |
|---|---|
| Notes | The query finds all the base tables that have at least two temporal columns where the name of the column refers to an event that may be caused by a state transition. The query shows all the temporal columns of the tables. It returns the name of table and its schema as well as names of Boolean columns. In case of the string_agg function, the line break (br) tag is used as a part of the separator for the better readability in case the query result is displayed in a web browser. The query may return false positive results if the columns are not used for the registration of data about the state. |
| Type | Problem detection (Each row in the result could represent a flaw in the design) |
| Reliability | Medium (Medium number of false-positive results) |
| License | MIT (opens in new tab) |
| Fixing Suggestion | Use instread state classifier. See Level 2 Status Pattern, Current Status from L. Silverston ja P. Agnew, „The Data Model Resource Book, Volume 3: Universal Patterns for Data Modeling,“ Chichester, John Wiley & Sons Ltd, 2009. |
| Data Source | INFORMATION_SCHEMA only |
| SQL Query |
|
Collections
This query belongs to the following collections:
Find problems about base tables
A selection of queries that return information about the data types, field sizes, default values as well as general structure of base tables. Contains all the types of queries - problem detection, software measure, and general overview
| Name | Description |
|---|---|
| Find problems about base tables | A selection of queries that return information about the data types, field sizes, default values as well as general structure of base tables. Contains all the types of queries - problem detection, software measure, and general overview |
Categories
This query is classified under the following categories:
Comfortability of database evolution
Queries of this category provide information about the means that influence database evolution.
Comfortability of data management
Queries of this category provide information about the means that have been used to make the use or management of database more comfortable and thus, more efficient.
Result quality depends on names
Queries of this category use names (for instance, column names) to try to guess the meaning of a database object. Thus, the goodness of names determines the number of false positive and false negative results.
State machine
Queries of this category provide information about registration of states of entities in a database.
Temporal data
Queries of this category provide information about temporal (time-related) data that is kept in the database.
| Name | Description |
|---|---|
| Comfortability of database evolution | Queries of this category provide information about the means that influence database evolution. |
| Comfortability of data management | Queries of this category provide information about the means that have been used to make the use or management of database more comfortable and thus, more efficient. |
| Result quality depends on names | Queries of this category use names (for instance, column names) to try to guess the meaning of a database object. Thus, the goodness of names determines the number of false positive and false negative results. |
| State machine | Queries of this category provide information about registration of states of entities in a database. |
| Temporal data | Queries of this category provide information about temporal (time-related) data that is kept in the database. |
Further reading and related materials:
| Reference |
|---|
| L. Silverston ja P. Agnew, „The Data Model Resource Book, Volume 3: Universal Patterns for Data Modeling,“ Chichester, John Wiley & Sons Ltd, 2009. Level 1 Status Pattern |
| https://dba.stackexchange.com/questions/206447/how-to-design-databse-for-storing-object-states-in-mysql |
| Representing the Status of the Main Entities of an Information System in SQL Databases Master Thesis, in Estonian. |