How to check if a table exists in the database?

SELECT * FROM Tab LIMIT 1

Too indirectly, besides, such a query will first vyrёt all the records from the table, then it will cut to 1. Is there something more elegant?

  • there is one bearded joke on this topic ... =) - Specter
  • Yes, I have already seen this joke)) - nMike

1 answer 1

one.

 SELECT table_name FROM information_schema.tables WHERE table_schema = 'databasename' AND table_name = 'tablename'; 

2

 show tables like 'tablename';