thanks for the help guys, but it still doesn't seem to work.  

I've tried the .schema and .tables commands, as well as:

SELECT * FROM SQLITE_MASTER WHERE type='table';

The 'sqlite' prompt just comes immediately back with no information.

SQLite version 2.8.15
Enter ".help" for instructions
sqlite> attach database 'prog.db' as AHA;
sqlite> .databases
seq  name             file                                                      
---  ---------------  ---------------------
0    main                                                                       
1    temp                                                                       
2    AHA              /ravine/users/civello/AHA/prog.db                         
sqlite> SELECT * FROM SQLITE_MASTER WHERE type='table';
sqlite> .tables 'AHA';
sqlite> .schema 'AHA';
sqlite> .schema prog.db;
sqlite> .schema '/ravine/users/civello/AHA/prog.db';

No luck.  But here's a query with this that works:

sqlite> select distinct aol_keywords.keyword from aol_keywords where keyword 
like
'Pulmonary%';
Pulmonary artery
Pulmonary circulation
Pulmonary edema
Pulmonary embolism
Pulmonary function
Pulmonary heart disease
Pulmonary valve
sqlite> 

Okay, so AOL_KEYWORDS is a table in this 'prog.db' file...  but:

sqlite> .tables AOL_KEYWORDS;
sqlite> .tables 'AOL_KEYWORDS';

isn't giving me any information.

ideas?  Thanks again.

incidentally, there's a string in this 'prog.db' file that says:

~/AHA> strings prog.db | head -1 
** This file contains an SQLite 2.1 database **
~/AHA> 

but using sqlite3, I can't attach the database.  It says:

SQLite version 3.0.8
Enter ".help" for instructions
sqlite> attach database 'prog.db' as AHA;
SQL error: file is encrypted or is not a database

Maybe  version 2 and 3 aren't compatible, I dunno...just thought I'd mention it.



> Daniel,
> 
>          Like this?  Look at the .database and the .schema and .tables...
> 
> Steve
> 
> 
> 
> sqlite> .help
> .databases             List names and files of attached databases
> .dump ?TABLE? ...      Dump the database in a text format
> .echo ON|OFF           Turn command echo on or off
> .exit                  Exit this program
> .explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.
> .header(s) ON|OFF      Turn display of headers on or off
> .help                  Show this message
> .indices TABLE         Show names of all indices on TABLE
> .mode MODE             Set mode to one of "line(s)", "column(s)",
>                        "insert", "list", or "html"
> .mode insert TABLE     Generate SQL insert statements for TABLE
> .nullvalue STRING      Print STRING instead of nothing for NULL data
> .output FILENAME       Send output to FILENAME
> .output stdout         Send output to the screen
> .prompt MAIN CONTINUE  Replace the standard prompts
> .quit                  Exit this program
> .read FILENAME         Execute SQL in FILENAME
> .schema ?TABLE?        Show the CREATE statements
> .separator STRING      Change separator string for "list" mode
> .show                  Show the current values for various settings
> .tables ?PATTERN?      List names of tables matching a pattern
> .timeout MS            Try opening locked tables for MS milliseconds
> .width NUM NUM ...     Set column widths for "column" mode
> sqlite>
> 
> 
> -----Original Message-----
> From: daniel civello [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 23, 2004 1:34 PM
> To: [EMAIL PROTECTED]
> Subject: [sqlite] basic question?
> 
> Hi all -- I'm having trouble understanding how to get a list of tables
> and the column
> names that are in a database.  
> 
> I've successfully attached a database via the sqlite command line, and
> I know a few
> queries which run against the database successfully, so I know it's
> set up correctly.
> Now, how do I get a list of the tables and columns?  I'm basically
> wondering if there's a
> 'show tables'  or 'desc <table>' command like in mysql.
> 
> thanks!
> -daniel
> 

Reply via email to