How to treat 'show tables' as Select?

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


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-23-2007
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

Reply With Quote
  #2 (permalink)  
Old 06-23-2007
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!


Reply With Quote
  #3 (permalink)  
Old 06-23-2007
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.

Reply With Quote
  #4 (permalink)  
Old 06-23-2007
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)
Reply With Quote
  #5 (permalink)  
Old 06-23-2007
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!


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:46 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0