For Postgres you could use something like this: SELECT t.table_schema AS schema_name, t.table_name, c.column_name, c.data_type, c.character_maximum_length, c.numeric_precision, c.is_nullable, c.column_default FROM information_schema.tables t JOIN information_schema.columns c ON t.table_name = c.table_name WHERE t.table_type = 'BASE TABLE' AND t.table_schema NOT IN ('information_schema', 'pg_catalog') ORDER BY t.table_schema, t.table_name, c.ordinal_position;
Have a question about databases? Feel free to drop it below!
does it work for postgres too?
For Postgres you could use something like this:
SELECT
t.table_schema AS schema_name,
t.table_name,
c.column_name,
c.data_type,
c.character_maximum_length,
c.numeric_precision,
c.is_nullable,
c.column_default
FROM
information_schema.tables t
JOIN
information_schema.columns c
ON
t.table_name = c.table_name
WHERE
t.table_type = 'BASE TABLE'
AND t.table_schema NOT IN ('information_schema', 'pg_catalog')
ORDER BY
t.table_schema, t.table_name, c.ordinal_position;
@@sqlanswers Thank you. I'll try it and get back to you. 😊
????? paste it in the description or put a pastebin link in the description
Hi - Sorry, can you rephrase your question? I'm not sure what you are referring to. Thanks!
@@sqlanswerspaste the template from 1:20 and 2:40 in the description or a website like pastebin please 🥺🥺🥺
Ah, the queries. Sure, please see the description. Added there