Unix Technical Forum

How to treat 'show tables' as Select?

This is a discussion on How to treat 'show tables' as Select? within the MySQL forums, part of the Database Server Software category; --> I want to get metadata about table and column names. When using mysql4, this can be done with 'show ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:05 AM
bent@lortemail.dk
 
Posts: n/a
Default How to treat 'show tables' as Select?

I want to get metadata about table and column names. When using
mysql4, this can be done with 'show tables' and 'desc table'. But i
would like to treat these commands as Select statements so i can
combine it with more sql, like where, limit, count, order by, etc.

For example something like:
select (show tables) where table like '%abc%' limit 10;

or for Desc only get the name and datatype:
select Field, Type from (desc table);

Anyone know a syntax that allows me to accomplish this?

thanks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:06 AM
Paul Lautman
 
Posts: n/a
Default Re: How to treat 'show tables' as Select?

bent@lortemail.dk wrote:
> I want to get metadata about table and column names. When using
> mysql4, this can be done with 'show tables' and 'desc table'. But i
> would like to treat these commands as Select statements so i can
> combine it with more sql, like where, limit, count, order by, etc.
>
> For example something like:
> select (show tables) where table like '%abc%' limit 10;
>
> or for Desc only get the name and datatype:
> select Field, Type from (desc table);
>
> Anyone know a syntax that allows me to accomplish this?
>
> thanks


About 2 weeks ago someone asked exactly the same question on this very
group.

I'm amazed that the search you did before asking this question did not find
it!


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:06 AM
bent@lortemail.dk
 
Posts: n/a
Default Re: How to treat 'show tables' as Select?


>
> About 2 weeks ago someone asked exactly the same question on this very
> group.
>
> I'm amazed that the search you did before asking this question did not find
> it!


Yes, i have searched thoroughly regarding this subject before
posting....
Maybe you did not read or understand the question in my post at all?

In any case comments like yours now make another populated thread on
this issue with no solution, thereby making it even harder to search
and find the answer for others.

So, answers and suggestions to my post are welcome... but the smart-
ass comments you can keep to yourself, sir.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 11:06 AM
Kees Nuyt
 
Posts: n/a
Default Re: How to treat 'show tables' as Select?

On Sat, 23 Jun 2007 08:18:08 -0700, bent@lortemail.dk wrote:

>
>>
>> About 2 weeks ago someone asked exactly the same question on this very
>> group.
>>
>> I'm amazed that the search you did before asking this question did not find
>> it!

>
>Yes, i have searched thoroughly regarding this subject before
>posting....
>Maybe you did not read or understand the question in my post at all?
>
>In any case comments like yours now make another populated thread on
>this issue with no solution, thereby making it even harder to search
>and find the answer for others.
>
>So, answers and suggestions to my post are welcome... but the smart-
>ass comments you can keep to yourself, sir.


try:
Message-ID: <5d55kpF32i5luU1@mid.dfncis.de>
Subject: Treat results of SHOW STATUS as table
--
( Kees
)
c[_] The only reason some people get lost in thought is
because it's unfamiliar territory. (Paul Fix) (#92)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 11:06 AM
Paul Lautman
 
Posts: n/a
Default Re: How to treat 'show tables' as Select?

Kees Nuyt wrote:
> On Sat, 23 Jun 2007 08:18:08 -0700, bent@lortemail.dk wrote:
>
>>
>>>
>>> About 2 weeks ago someone asked exactly the same question on this
>>> very group.
>>>
>>> I'm amazed that the search you did before asking this question did
>>> not find it!

>>
>> Yes, i have searched thoroughly regarding this subject before
>> posting....
>> Maybe you did not read or understand the question in my post at all?
>>
>> In any case comments like yours now make another populated thread on
>> this issue with no solution, thereby making it even harder to search
>> and find the answer for others.
>>
>> So, answers and suggestions to my post are welcome... but the smart-
>> ass comments you can keep to yourself, sir.

>
> try:
> Message-ID: <5d55kpF32i5luU1@mid.dfncis.de>
> Subject: Treat results of SHOW STATUS as table


But Kees, that is precisely the thread that I tried to direct the OP to!

You are brave to try again!


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:46 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com