If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > query to retrieve primary key

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-10-03, 07:01
raseena raseena is offline
Registered User
 
Join Date: Nov 2003
Posts: 87
Thumbs up query to retrieve primary key

1)i wanna know the query which retrieves the primary key of a table.

2)query to retrieve the primary key and table names.


If anyone knows the query, expecting replies.
Reply With Quote
  #2 (permalink)  
Old 11-10-03, 07:27
Mincer Mincer is offline
Registered User
 
Join Date: Sep 2003
Location: London
Posts: 56
To get the tables in a database:

Code:
SHOW TABLES ;
To show the indexes on a table;

Code:
SHOW INDEXES FROM  tableName ;
(You'll have to grab the line with an index name of PRIMARY KEY from that)

Regards,

Matt.
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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On