Community Page
- www.tech-recipes.com/ Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- Google is the best search engine...what else I can say? But I dont use google chrome, I prefer other browser
- Thank you so much i haven't had to do that on vista and nearly two years and have used a seperate quick launce bar for many many years and it was driving me insane
- Lovely! I completely forgot about dos2unix and sincerely I like to use vim better if I can :)
- hey shay, just added you. add me if you want 4285 2670 2528 4658
- Thats cool Stuff as i m Nebie to unix
Tech-Recipes
Cookbook of Tech TutorialsDisplay or show tables in a PostgreSQL/PgSQL database | PostgreSQL PgSQL | Tech-Recipes
Started by qdideas · 9 months ago
4 years ago
4 years ago
select pg_class.relname, pg_attribute.attname, pg_type.typname from pg_class, pg_attribute, pg_type where pg_class.relname = 'YOURTABLENAME' and pg_class.oid = pg_attribute.attrelid and pg_type.oid = pg_attribute.atttypid having attnum > 0
Ivan
3 years ago
SHOW TABLES = d
SHOW DATABASES = l
SHOW COLUMNS = d table
However the * commands only work in psql and not via other interfaces, such as queries via PHP. Similar data can be retrieved with the following SQL commands:
So in the psql console type
l to see the databases,
d ....
SHOW TABLES (d) = SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'
SHOW DATABASES (l) = SELECT datname FROM pg_database;
SHOW COLUMNS FROM table (d table) = SELECT column_name FROM information_schema.columns WHERE table_name ='table';
Check the user comment on this postgre doc. page
http://www.postgresql.org/docs/8.0/interactive/...
<ul id="quote"><h6>none wrote:</h6>Is there any equivalent form for this in SQL?</ul>