February 16th, 2004, 08:18 PM
How do I find out what tables are on the database?
I have been wondering about this for some time and I can't seem to get it. I want to be able to go
or something and it will show me all the tables in the database. It would also be great to have a way of finding out what fields are in each table, instead of having to go
SELECT * FROM address;
and break it halfway through to find out what the fields are.
I am using and Oracle 8i database (I think).
February 17th, 2004, 03:03 AM
The accessible tables are stored in ALL_TABLES or USER_TABLES
The column definitions are stored in ALL_TAB_COLUMNS or USER_TAB_COLUMNS
I don't now what kind of client you are using, but in SQL*Plus you can also do a DESC address to get the table's definition
February 17th, 2004, 12:43 PM
How do i query the last 10 rows from the table?
February 17th, 2004, 02:09 PM
I'm not sure what you mean with "last 10 rows" as tables don't have a last and a first row. But I'm assuming you can order them somehow, but
FROM (SELECT * FROM table ORDER BY column)
WHERE ROWNUM < 11
should do what you want.
February 17th, 2004, 04:14 PM
February 17th, 2004, 08:24 PM
So how did you know that ALL_TABLES exists? Is there a table with the system tables in it? I'm thinking there are other tables like ALL_TABLES that would be useful - where can I find out about them?
February 18th, 2004, 02:04 AM
February 18th, 2004, 08:18 AM
Originally Posted by shammat
i managed to get it thank you
actually the above query doesn't really return the last 10 rows it will still return the 10 rows
it should be
Select * from table_name where rownum < 11 order by column_name desc