On Tue, Apr 24, 2001 at 04:20:26PM -0400, Mark Riehl wrote:
> All,
> 
> What's the easiest way to check and see if a table already exists in a
> database?  I'm running MySQL on a Win2k box.
> 
> The New Riders MySQL book has the following statements:
> SELECT COUNT(*) FROM table_name
> SELECT * FROM table_name WHERE 1=0
> 
> Each statement will succeed if the table exists.
> 
> Any other way (other than calling $dbh->tables() and looping through the
> results?

SELECT 1 FROM table_name (just another variant of yours).

-- 
Thomas Eibner - <http://thomas.eibner.dk/>

Reply via email to