Ask Your Question
0

Inside a database, sql query to get a list of tables [closed]

asked 2014-04-04 16:12:08 +0100

Gerard SAUVAGE gravatar image

updated 2015-09-09 01:40:07 +0100

Alex Kemp gravatar image

Hello everybody,

Inside a database, does somebody know how to get a list of tables & a list of a table's fields using SQL an SQL only ?

(LibreOffice Base on Windows Vista and/or 8.)

Thank you for your help.

Gerard SAUVAGE

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-20 19:20:07.502199

Comments

A NON-SQL method would be through JDBC: Jenkov.com example, Oracle.com reference. Which you might want to try in case there are no SQL-ONLY methods.

黄智壯 gravatar image黄智壯 ( 2014-04-05 08:24:08 +0100 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2014-04-05 17:08:50 +0100

w_whalley gravatar image

If you are using the embedded HSQLDB engine these will give you that information. Table names are in column TABLE_NAME in this query:

SELECT * FROM INFORMATION_SCHEMA.SYSTEM_TABLES WHERE TABLE_TYPE='TABLE';

Column names (and other column parameters) are obtained by this query:

SELECT * FROM INFORMATION_SCHEMA.SYSTEM_COLUMNS WHERE TABLE_NAME NOT LIKE 'SYSTEM_%';
edit flag offensive delete link more
0

answered 2014-04-08 11:48:19 +0100

Gerard SAUVAGE gravatar image

Hello,

Both of the commands work well. Thank you very much for your help.

edit flag offensive delete link more

Comments

Hi Gerard, seems the @w_whalley answer is fine, please tick the answer as correct.

m.a.riosv gravatar imagem.a.riosv ( 2014-04-08 22:15:13 +0100 )edit

Question Tools

1 follower

Stats

Asked: 2014-04-04 16:12:08 +0100

Seen: 865 times

Last updated: Apr 08 '14