Query goal: | Find the number of base table columns based on data type. |
Notes about the query: | The query does not take into account different field sizes. |
Query type: | Sofware measure (Numeric values (software measures) about the database) |
Query license: | MIT License |
Data source: | INFORMATION_SCHEMA only |
SQL query: | Click on query to copy it
WITH cols AS (SELECT table_schema, table_name, column_name, CASE WHEN data_type='USER-DEFINED' THEN udt_name || '(' || data_type || ')' ELSE data_type END AS data_type FROM INFORMATION_SCHEMA.columns INNER JOIN INFORMATION_SCHEMA.tables USING (table_schema, table_name) WHERE table_type='BASE TABLE' AND table_schema NOT IN (SELECT schema_name FROM INFORMATION_SCHEMA.schemata WHERE schema_name<>'public' AND schema_owner='postgres' AND schema_name IS NOT NULL)) SELECT data_type, Count(*) AS nr_of_data_types FROM cols GROUP BY data_type ORDER BY Count(*) DESC, data_type; |
Collection name | Collection 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 |
Find problems by overview | Queries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not . |
Find quick numeric overview of the database | Queries that return numeric values showing mostly the number of different types of database objects in the database |
Category name | Category description |
---|---|
Data types | Queries of this category provide information about the data types and their usage. |