Thanks Larry,

I was able to accomplish what I needed from you examples.  But for the column 
information, I used;

SELECT * FROM SYS_COLUMNS WHERE SYS_COLUMN_ID = <SYS_COLUMN_ID>

instead of

LIST COLUMN <colname>

But your examples put me on the right path.  Thanks again.

Mike

From: [email protected] [mailto:[email protected]] On Behalf Of Lawrence Lustig
Sent: Monday, March 30, 2009 8:38 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: A Few Questions

I need to know the SQL to;

Each of your questions can be answered in two ways — using SQL or using R:Base 
specific commands

1.       List all of the tables within the database
LIST TABLES will list all the tables in your database.
LIST VIEWS will list all the views.
LIST will last all the relations (tables and views) except for "system" tables.

SELECT * FROM SYS_TABLES is the SQL meta approach to getting this information.  
SYS_TABLES is not a real table in the database, but is generated to give you an 
SQL window into the databas structure.

2.       List all of the columns within a particular table

LIST <<TableName>> will list the structure of the table <<TableName>> including 
all columns and their definitions (some other information too — indexing, etc)

To use SQL to do this, you first need to look at the SYS_TABLES table to 
extract the SYS_TABLE_ID for the table, then do:

SELECT * FROM SYS_COLUMNS WHERE SYS_TABLE_ID = <<Value Here>>

3.       List a particular column type and length

LIST COLUMN <<ColName>> will list all the tables containing the named column, 
plus the structure.

--
Larry

Reply via email to