Z
Z
zaychonok_lisa2021-11-27 16:56:31
PostgreSQL
zaychonok_lisa, 2021-11-27 16:56:31

How to view created columns in created table in PostgreSQL?

In Mysql, this is possible: but how to display this in posgres? This command only works in the console: How can I view it with a query in DBeaver?
show columns from имя_таблицы;
\d имя_таблицы;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2021-11-27
@zaychonok_lisa

Column information is contained in the information_schema.columns view

SELECT
  *
FROM
  information_schema.columns
WHERE
  table_schema = 'schema_name'
  AND table_name = 'table_name';

PostgreSQL information_schema.columns
for example:
create table books (
  ID INT,
  	AUTHOR VARCHAR
);


SELECT
  *
FROM
  information_schema.columns
WHERE	table_name = 'books';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question