Difference between revisions of "Using the PostgreSQL System Tables"

From Jens' Hjørne
Jump to navigation Jump to search
m (Created page with "==Finding columns and their data types for a specific table== select c.table_name, c.column_name, c.data_type, character_maximum_length from information_schema.columns as c ...")
 
m
 
Line 1: Line 1:
 
==Finding columns and their data types for a specific table==
 
==Finding columns and their data types for a specific table==
  
−
  select c.table_name, c.column_name, c.data_type, character_maximum_length  
+
  select c.table_name, c.column_name, c.data_type, c.character_maximum_length  
 
  from information_schema.columns as c  
 
  from information_schema.columns as c  
 
  where c.table_name = 'TABLENAME';
 
  where c.table_name = 'TABLENAME';
  
 
[[Category:SQL]]
 
[[Category:SQL]]

Latest revision as of 13:45, 24 May 2018

Finding columns and their data types for a specific table

select c.table_name, c.column_name, c.data_type, c.character_maximum_length 
from information_schema.columns as c 
where c.table_name = 'TABLENAME';