473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to list the tables that we have created?

how to list the tables that we have created ?
Jan 23 '11 #1
2 2182
mwasif
802 Expert 512MB
This is the command to show all the tables inside a database.

Expand|Select|Wrap|Line Numbers
  1. SHOW TABLES;
Jan 23 '11 #2
dgreenhouse
250 Expert 100+
If you want to show all databases and tables and assuming you have access to MySQL's information_schema database, this query will list the databases and tables created. Note that "information_schema and mysql" are part of MySQL's engine. I've also instructed the query to not show tables associated with "phpmyadmin."

Expand|Select|Wrap|Line Numbers
  1. SELECT table_schema,table_name FROM information_schema.tables
  2. WHERE table_schema not in ("information_schema","phpmyadmin","mysql") order by table_schema,table_name
  3.  
Note: table_schema is the database name

Also note:
The above query will only show databases with tables created.
If you want to show all databases (with or without created tables), you'd need to perform an "outer join" on the "schemata" table. The OUTER is typically optional with the RIGHT {JOIN} predicate.

i.e.
Expand|Select|Wrap|Line Numbers
  1. SELECT b.schema_name,a.table_name FROM information_schema.tables a
  2. RIGHT OUTER JOIN schemata b on b.schema_name = a.table_schema
  3. WHERE b.schema_name not in ("information_schema","phpmyadmin","mysql") order by b.schema_name,a.table_name
  4.  
Feb 26 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Wayne Wengert | last post by:
I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000 database. I want to display a list of all tables in an Access database. I want to put that list of table names in a listbox so the user...
1
by: Mariusz Kaczmarczyk | last post by:
Hello, i can't find any matching answer for this question. How to construct SQL query to list all tables in current database? Let's say i use the default view. Or maybe there is better way in PHP...
9
by: Peter Moscatt | last post by:
Is there a SQL command I can issue which will list all the TABLES within a database ? Pete ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9'...
3
by: maricel | last post by:
Is there a way to list (using db2 command or catalogs) to list hierarchy of table parent & child relationship: 1) A list that shows which table should be deleted first,second,third... 2) A list...
1
by: narayana | last post by:
how to know about how many tables i created in that database.if the database is connected to many users. i want the query in this way that i want creater,number of tables,time,updates . the...
2
by: sastry.m.s | last post by:
Hi, I have tables created in my DB2 database created under a schema. Now i want to get connected to these tables with a username different from this schema name from my java application. When...
1
by: Stefan van Roosmalen | last post by:
Hi there, Is there a way to list the TEMPORATY tables? I have tried SHOW TABLES, but this command only list the regular tables. Thank you very much for your answer. Regards, Stefan.
0
by: master | last post by:
Hi, I am new to SQL CE. How to get the list of tables in a database? Thanks for your help... DW
2
by: Danny | last post by:
Hello, We imported a bunch of tables from a database and realized that the primary keys weren't copied to the destination db. In order to re- create the keys, we need to know which tables have...
1
by: daveni2002 | last post by:
Im currently trying to come up with the xsl to create a table depending on how much info is in the xml file e.g. use one template that will work with multiple number of different table sizes. the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.