Re: SQL*Plus newbie questions

From: Chris Kasten <kasten_at_brookings.net>
Date: 1996/01/22
Message-ID: <31041139.6745064_at_news.brookings.net>#1/1


robert.hatcher_at_citicorp.com (Robert Hatcher) wrote:

> : 1. Once connected to the database via SQL*Plus, how do you list
> : the tables. (Informix equivalent: info tables)
>
> Many ways: select table_name from sys.dba_tables where owner <>'SYS';

OR describe and use the view TABS or USER_TABLES

>
> : 2. Are there any system catalog tables which hold info about
> : the tables, columns, etc in the database.
> : (Informix equivalent: systables, syscolumns, etc)
>
> sys.dba tables, sys.dba_tab_columns, etc. You can desc sys.dba_tab_columns
> to view their structure. These are all doc's in the manuals (and various
> posters from different vendors....)
>

for most of these sys.dba views there is an equivalent user_ view (ie user_tables, user_tab_columns, user_indexes, etc).

> : 3. How do you determine the number of tables in the database.
> : (Informix equivalent:
> : select count(*) from systables where tabtype = "T")
>
> select count(*) from sys.dba_tables where owner <> 'SYS'; (unless you want the
> sys tables also...
>
> : 4. How do you list the columns in a table.
> : (Informix equivalent: info columns for tablename)
>
>
> select column_name from sys.dba_tab_columns where table_name='TABLE_NAME';
>

"describe tablename" is probably the quickest way I know of.

Hope this helps (sorry I replied on a reply - missed the original)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Chris Kasten
Programmer/Analyst (among others...)

#include <sys/std_disclaimer.h>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Received on Mon Jan 22 1996 - 00:00:00 CET

Original text of this message