Re: dumb sql question
Posted in 1993
Topics: General Discussion
>Is there a way to querry a database (whose name you do know) and get a >list of its tables ? I'd also like to get a list of columns for a table >(once I know its name) Well, I got a bunch of pretty creative answers but none are as simple as the one I found in the manual. ACK! I can't believe I was desperate enough to look in the manual. I hope this doesn't make me less of a man. Anyway, it's easy. To get a list of tables in SQL (or at least informix SQL) you do this: "info tables;". And you get a list back: Table name charges disks equipment keys outlets owners people peripherals rooms users Once you know the names of the tables (one of mine is "equipment" from above) you do this: "info columns for equipment;" and you get a list of columns: Column name Type Nulls cmu integer yes serial_number char(20) yes name char(12) yes make char(12) yes model char(12) yes purchase_date date yes room char(6) yes class char(1) yes status char(1) yes Thanks to all who offered me help. Matt Matt Mashyna -------------------------------------------------------------------------- email mashyna@cmu.edu * voice 412-268-2800 * fax: 412-268-2798 Manager of the Computing Facilities, CMU Psychology, Pittsburgh, PA 15213