How can I list all tables in a database with Squirrel SQL?

☆樱花仙子☆ 提交于 2019-12-20 17:34:26

问题


I use Squirrel SQL to connect to a JavaDB/Derby database on my desktop. I can run SQL queries.

But how can I list all tables in the database? And preferably all column and column types.


回答1:


You can do it easily from the GUI. After you open your session, click the Objects tab, then expand the tree. Expand the db, schema, and then table nodes, and you'll see all of your tables. If you click on a particular table node, a table will open to the right. By clicking the Columns tab, you can get the column names, types, and other meta data.

Or are you looking for SQL commands?




回答2:


Sometimes I noticed that doing the above may not result in the tables showing. Before I figured this out, my table node will not be expandable and I can never get a list of the tables.

After a lot of searching on the internet, I learnt that you need to choose the schema from the catalog drop down box located at the upper left portion of the squirrel sql client before the icons to be able to get the table list for that particular schema.

Hope that helps.




回答3:


I know this is quite an old question. I was stuck with this for the last 3 days (google search results didn't help) I'm using Squirrel 3.4 and had to connect to a old DB2 database. I could connect to the DB but could not see the tables for 3 days. Finally got it, here is what worked for me -

  1. Edit Alias Properties -> click properties - select the radio button "Specify schema loading and caching" -> click on "Connect database and refresh Schema table".
  2. Once you do this all the schema's are loaded in the pop up window.
  3. Select the ones you need and change the option to 'Load and cache'. Reconnect to this session.
  4. Select the schema name from the catalog drop down and refresh



回答4:


We had this issue using SQuirreL SQL Client with Amazon Redshift PostgreSQL.

A short-term solution just was to use:

SELECT * FROM information_schema.columns

RJ.'s solution worked for some machines (thanks) and not others

In the end we realized it was a driver issue. We needed postgresql-8.4-...jar from http://jdbc.postgresql.org/download.html#others



来源:https://stackoverflow.com/questions/4896613/how-can-i-list-all-tables-in-a-database-with-squirrel-sql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!