Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old February 16th, 2004, 08:18 PM
Swell Swell is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 6 Swell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How do I find out what tables are on the database?

Hi,

I have been wondering about this for some time and I can't seem to get it. I want to be able to go

SELECT sysadm.systables;

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).

Reply With Quote
  #2  
Old February 17th, 2004, 03:03 AM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 931 shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 4 h 43 m 6 sec
Reputation Power: 54
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

Reply With Quote
  #3  
Old February 17th, 2004, 12:43 PM
katkam_77 katkam_77 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 8 katkam_77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Query

How do i query the last 10 rows from the table?

Reply With Quote
  #4  
Old February 17th, 2004, 02:09 PM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 931 shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 4 h 43 m 6 sec
Reputation Power: 54
Quote:
How do i query the last 10 rows from the table?


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

SELECT *
FROM (SELECT * FROM table ORDER BY column)
WHERE ROWNUM < 11

should do what you want.

Reply With Quote
  #5  
Old February 17th, 2004, 04:14 PM
Swell Swell is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 6 Swell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks heaps!

Reply With Quote
  #6  
Old February 17th, 2004, 08:24 PM
Swell Swell is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 6 Swell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #7  
Old February 18th, 2004, 02:04 AM
shammat shammat is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 931 shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level)shammat User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 4 h 43 m 6 sec
Reputation Power: 54
This is all documented in the manuals, it really helps to read them

For 8.1.7 it's here: http://download-uk.oracle.com/docs/...1/doc/index.htm
For the current releases you can find it here: http://otn.oracle.com/documentation/index.html

And of course on your installation CD

Reply With Quote
  #8  
Old February 18th, 2004, 08:18 AM
katkam_77 katkam_77 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 8 katkam_77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
query

Quote:
Originally Posted by shammat
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

SELECT *
FROM (SELECT * FROM table ORDER BY column)
WHERE ROWNUM < 11

should do what you want.


thanks anyway

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > How do I find out what tables are on the database?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway