Filter Queries

Found 1053 queries.

  • All the queries about database objects contain a subcondition to exclude from the result information about the system catalog.
  • Although the statements use SQL constructs (common table expressions; NOT in subqueries) that could cause performance problems in case of large datasets it shouldn't be a problem in case of relatively small amount of data, which is in the system catalog of a database.
  • Statistics about the catalog content and project home in GitHub that has additional information.

#201. Many-to-many relationship types that do not have additional attributes

INFORMATION_SCHEMA+system catalog base tables

Find base tables that implement many-to-many relationship types that do not permit repeating relationships. More specifically find tables that have two or more foreign keys and all the columns of the table are either foreign key columns or a surrogate key column. It could be that during the system analysis a mistake has been made and some attributes of the entity type that represents the relationship type have not been discovered.

Problem detection License: MIT (opens in new tab)

#202. Many-to-many relationship types that do not permit repeating relationships and do not have additional attributes

INFORMATION_SCHEMA+system catalog base tables

Find base tables that implement many-to-many relationship types that do not permit repeating relationships. More specifically find tables that have two or more foreign keys and all the columns of the table belong to a foreign key. In addition, all the table columns must be covered by a primary key or unique constraint. It could be that during the system analysis a mistake has been made and some attributes of the entity type that represents the relationship type have not been discovered.

Problem detection License: MIT (opens in new tab)

#203. Do not create multiple columns for the same attribute

INFORMATION_SCHEMA only

Find base tables that implement recording multivalued attribute values with the help of repeating group of columns. Find base tables that have more than one columns with the same type and field size and the difference between the columns are the numbers in the column names (column1, column2, etc.).

Problem detection License: MIT (opens in new tab)

#204. Prefixes of base table names

INFORMATION_SCHEMA only

Find base tables that name starts with a prefix. Do not use prefixes in case of base table names. Derive the names from the names of entity types. Do not use "_", "t_", "tab_", "t11_" etc as prefixes of a table.

Problem detection License: MIT (opens in new tab)

#205. All the non-primary key columns are optional

INFORMATION_SCHEMA only

Find base tables where all he non-primary key columns are optional. Avoid too many optional columns. You have to be extra careful with NULLs in case of formulating search conditions of data manipulation statements.

Problem detection License: MIT (opens in new tab)

#206. Base tables where all the columns are optional

INFORMATION_SCHEMA only

Find base tables where all the columns are optional, i.e., permit NULLs. In such tables can be rows with no identity value and thus indistinguishable from other rows.

Problem detection License: MIT (opens in new tab)

#207. All columns of a base table have a default value

INFORMATION_SCHEMA only

Find base tables where all the columns have a default value.

Problem detection License: MIT (opens in new tab)

#208. All unique keys have at least one optional column

INFORMATION_SCHEMA+system catalog base tables

Find base tables where all unique keys (sets of columns covered by a unique constraint, or a unique index) have at least one optional column. In this case there can be rows in the table where the values that should identify the row are missing. Because NULL is not a value and is not duplicate of another NULL the, follwing is possible: CREATE TABLE Uniq(a INTEGER NOT NULL,
b INTEGER,
CONSTRAINT ak_uniq UNIQUE (a, b));

INSERT INTO Uniq(a, b) VALUES (1, NULL);
INSERT INTO Uniq(a, b) VALUES (1, NULL);

Problem detection License: MIT (opens in new tab)

#209. Perhaps a redundant column (based on sequence generators)

INFORMATION_SCHEMA only

Find base tables where more than one column gets the default value by using the sequence generator mechanism.

Problem detection License: MIT (opens in new tab)

#210. Multiple columns in the same base table that are associated with a sequence generator

INFORMATION_SCHEMA only

Find base tables where multiple columns are associated with a sequence generator. Do not create unnecessary sequence generators. If one uses in a table a surrogate key, then it is enough to have one column where the values are generated by using a (external or internal) sequence generator.

Problem detection License: MIT (opens in new tab)

#211. Base tables, which statistics is probably not up to date

INFORMATION_SCHEMA+system catalog base tables

Find base tables where statistics has not been collected at all or it has been lastly collected more than 40 days ago.

Problem detection License: MIT (opens in new tab)

#212. Empty tables

system catalog base tables only

Find base tables where the number of rows is zero. If there are no rows in a table, then it may mean that one hasn't tested constraints that have been declared to the table or implemented by using triggers. It could also mean that the table is not needed because there is no data that should be registered in the table.

Problem detection License: MIT (opens in new tab)

#213. Base tables where uniqueness is achieved by using only unique indexes

INFORMATION_SCHEMA+system catalog base tables

Find base tables where uniqueness is achieved by using only unique indexes, i.e., there is at least one unique index but no uniqueness constraints (PRIMARY KEY, UNIQUE, EXCLUDE)

Problem detection License: MIT (opens in new tab)

#214. Base tables with multiple comment columns

INFORMATION_SCHEMA only

Find base tables with more than one comment columns

General License: MIT (opens in new tab)

#215. Base tables with multiple name columns

INFORMATION_SCHEMA only

Find base tables with more than one name columns. Perhaps the normalization level of the table is low.

General License: MIT (opens in new tab)

#216. Base tables that have no uniqueness requirement for rows whatsoever

INFORMATION_SCHEMA+system catalog base tables

Find base tables without any unique constraints and primary key as well as any unique index, whether it is created explicitly by a developer or automatically by the DBMS. The only legitimate reason of such a table is if it is an abstract table that is used to define common columns of subtables.

Problem detection License: MIT (opens in new tab)

#217. Base tables that have neither a unique constraint nor the primary key

INFORMATION_SCHEMA only

Find base tables without any unique constraints and the primary key. In such tables there are no restrictions for recording duplicate rows. Each row represents a true proposition about the real world. It does not make the proposition truer if one presents it more than once. Moreover, duplicate rows increase data size. Without keys the DBMS lacks vital information about data in the database that it can internally use to choose better execution plans and in this way improve performance of database operations. The only legitimate reason of such a table is if it is an abstract table that is used to define common columns of subtables.

Problem detection License: MIT (opens in new tab)

#218. Perhaps incorrect use of 'NULL'

INFORMATION_SCHEMA+system catalog base tables

Find Boolean expressions, queries, routines, and default values that refer to value 'NULL'. Perhaps NULL was intended instead. 'NULL' is a string (a value) but NULL is a special marker for denoting missing value.

Problem detection License: MIT (opens in new tab)

#219. Too generic names (candidate key columns)

system catalog base tables only

Find candidate key columns with the names like id, identifikaator, code, kood, number, etc. The names should have a prefix or a suffix. These are too generic names.

Problem detection License: MIT (opens in new tab)

#220. Do not clone tables

INFORMATION_SCHEMA only

Find cases where a base table has been split horizontally into multiple smaller base tables based on the distinct values in one of the columns of the original table. Each such newly created table has the name, a part of which is a data value from the original tables. Find base tables that have the same columns (column name, column order, data type) and the difference between the tables are the numbers in the table names (table1, table2, etc.).

Problem detection License: MIT (opens in new tab)
# Name Goal (sorted ascending) Type Data source Last update License Actions
201 Many-to-many relationship types that do not have additional attributes Find base tables that implement many-to-many relationship types that do not permit repeating relationships. More specifically find tables that have two or more foreign keys and all the columns of the table are either foreign key columns or a surrogate key column. It could be that during the system analysis a mistake has been made and some attributes of the entity type that represents the relationship type have not been discovered. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
202 Many-to-many relationship types that do not permit repeating relationships and do not have additional attributes Find base tables that implement many-to-many relationship types that do not permit repeating relationships. More specifically find tables that have two or more foreign keys and all the columns of the table belong to a foreign key. In addition, all the table columns must be covered by a primary key or unique constraint. It could be that during the system analysis a mistake has been made and some attributes of the entity type that represents the relationship type have not been discovered. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
203 Do not create multiple columns for the same attribute Find base tables that implement recording multivalued attribute values with the help of repeating group of columns. Find base tables that have more than one columns with the same type and field size and the difference between the columns are the numbers in the column names (column1, column2, etc.). Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
204 Prefixes of base table names Find base tables that name starts with a prefix. Do not use prefixes in case of base table names. Derive the names from the names of entity types. Do not use "_", "t_", "tab_", "t11_" etc as prefixes of a table. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
205 All the non-primary key columns are optional Find base tables where all he non-primary key columns are optional. Avoid too many optional columns. You have to be extra careful with NULLs in case of formulating search conditions of data manipulation statements. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
206 Base tables where all the columns are optional Find base tables where all the columns are optional, i.e., permit NULLs. In such tables can be rows with no identity value and thus indistinguishable from other rows. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
207 All columns of a base table have a default value Find base tables where all the columns have a default value. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
208 All unique keys have at least one optional column Find base tables where all unique keys (sets of columns covered by a unique constraint, or a unique index) have at least one optional column. In this case there can be rows in the table where the values that should identify the row are missing. Because NULL is not a value and is not duplicate of another NULL the, follwing is possible: CREATE TABLE Uniq(a INTEGER NOT NULL,
b INTEGER,
CONSTRAINT ak_uniq UNIQUE (a, b));

INSERT INTO Uniq(a, b) VALUES (1, NULL);
INSERT INTO Uniq(a, b) VALUES (1, NULL);
Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
209 Perhaps a redundant column (based on sequence generators) Find base tables where more than one column gets the default value by using the sequence generator mechanism. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
210 Multiple columns in the same base table that are associated with a sequence generator Find base tables where multiple columns are associated with a sequence generator. Do not create unnecessary sequence generators. If one uses in a table a surrogate key, then it is enough to have one column where the values are generated by using a (external or internal) sequence generator. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
211 Base tables, which statistics is probably not up to date Find base tables where statistics has not been collected at all or it has been lastly collected more than 40 days ago. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
212 Empty tables Find base tables where the number of rows is zero. If there are no rows in a table, then it may mean that one hasn't tested constraints that have been declared to the table or implemented by using triggers. It could also mean that the table is not needed because there is no data that should be registered in the table. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
213 Base tables where uniqueness is achieved by using only unique indexes Find base tables where uniqueness is achieved by using only unique indexes, i.e., there is at least one unique index but no uniqueness constraints (PRIMARY KEY, UNIQUE, EXCLUDE) Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
214 Base tables with multiple comment columns Find base tables with more than one comment columns General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
215 Base tables with multiple name columns Find base tables with more than one name columns. Perhaps the normalization level of the table is low. General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
216 Base tables that have no uniqueness requirement for rows whatsoever Find base tables without any unique constraints and primary key as well as any unique index, whether it is created explicitly by a developer or automatically by the DBMS. The only legitimate reason of such a table is if it is an abstract table that is used to define common columns of subtables. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
217 Base tables that have neither a unique constraint nor the primary key Find base tables without any unique constraints and the primary key. In such tables there are no restrictions for recording duplicate rows. Each row represents a true proposition about the real world. It does not make the proposition truer if one presents it more than once. Moreover, duplicate rows increase data size. Without keys the DBMS lacks vital information about data in the database that it can internally use to choose better execution plans and in this way improve performance of database operations. The only legitimate reason of such a table is if it is an abstract table that is used to define common columns of subtables. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
218 Perhaps incorrect use of 'NULL' Find Boolean expressions, queries, routines, and default values that refer to value 'NULL'. Perhaps NULL was intended instead. 'NULL' is a string (a value) but NULL is a special marker for denoting missing value. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
219 Too generic names (candidate key columns) Find candidate key columns with the names like id, identifikaator, code, kood, number, etc. The names should have a prefix or a suffix. These are too generic names. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
220 Do not clone tables Find cases where a base table has been split horizontally into multiple smaller base tables based on the distinct values in one of the columns of the original table. Each such newly created table has the name, a part of which is a data value from the original tables. Find base tables that have the same columns (column name, column order, data type) and the difference between the tables are the numbers in the table names (table1, table2, etc.). Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)