leppis75
asked on
How to print out MySQL table structure and content in text format on Mac OS X
Which MySQL editor could show my database table in the following kind of format? I'd also need to display the content in this kind of text format.
+-------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------------+------+-----+---------+----------------+
| product_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| url | varchar(100) | NO | UNI | NULL | |
| name | varchar(50) | NO | | NULL | |
| description | varchar(255) | NO | | NULL | |
| price | decimal(10,2) | NO | | NULL | |
| visible | tinyint(1) unsigned | NO | MUL | 1 | |
+-------------+---------------------+------+-----+---------+----------------+
ASKER
Thanks for the tip, but can I get it to print the tables out in that kind of text table format, that I'd pasted in my question? The reason why I'm asking is, that I'd like to, after finding the right tool, open another question, where I would copy-paste content from couple of tables in my database.
in most databases and in any tool with query capability just use this
sp_help tablename
In most tools where you can print the information shown on the screen you can just print this out
sp_help tablename
In most tools where you can print the information shown on the screen you can just print this out
If that doesn't work try this as a query - some tools won't output the actual table structure
This returns a text output that you can print...
select * from information_schema.columns where table_name='tablename'
This returns a text output that you can print...
select * from information_schema.columns
Sorry for so many comments - I just like to check my advice and I'm discovering options while I look at your issue.
In the Oracle SQL Developer - I just use this query - select * from information_schema.columns where table_name='tablename'
Then in the results pane I right click on the resulting table and I can export the results in about ten different formats including html, xls, csv, text etc... So it should do what you're looking for.
In the Oracle SQL Developer - I just use this query - select * from information_schema.columns
Then in the results pane I right click on the resulting table and I can export the results in about ten different formats including html, xls, csv, text etc... So it should do what you're looking for.
ASKER
No, I'm sorry, but I don't think any of this is what I'm looking for. I think, that if I could make the query in my Terminal, I'd get the result I want...
I think I'll give up and just take screenshots of what I need to show. Thanks for trying to help.
I think I'll give up and just take screenshots of what I need to show. Thanks for trying to help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hello leppis75
I am really pleased you managed to get this working. Automation makes life a little easier
All the best
seenall
I am really pleased you managed to get this working. Automation makes life a little easier
All the best
seenall
Here's a screen grab of the tool's view of a table structure. it's very similar to using Microsoft's Management Studio.
In my configuration I am connected to four different local Microsoft DBs - one web based MS SQL instance and 2 MySql instances - all different versions and locations and can work on all of them at the same time...
Takes a while to figure out how to configure everything but not terribly difficult the learn.
Screen-shot-2010-08-18-at-3.12.2.png