Jump to content

[SOLVED] Identifying a Primary Key in phpmyadmin


Maracles

Recommended Posts

I have just started learning mysql via phpmyadmin and was curious as to how primary keys are identified in the phpmyadmin interface. How can I tell which of my fields are primary keys and which are not, as I understand it there can only be one primary key per table? To set up my first database and tables I used the code provided in a book i'm learning from, the code is below.

 

Using this example the 'customerid' field in the 'customer' table is a primary key however I can see know way of identifying this via phpmyadmin other than when you enter the initial code. Any help would be appreciated.

 

 

create table customers
( customerid int unsigned not null auto_increment primary key,
  name char(50) not null,
  address char(100) not null,
  city char(30) not null
);

create table orders
( orderid int unsigned not null auto_increment primary key,
  customerid int unsigned not null,
  amount float(6,2),
  date date not null
);

create table books
(  isbn char(13) not null primary key,
   author char(50),
   title char(100),
   price float(4,2)
);

create table order_items
( orderid int unsigned not null,
  isbn char(13) not null,
  quantity tinyint unsigned,

  primary key (orderid, isbn)

);
create table book_reviews
(
  isbn char(13) not null primary key,
  review text
);

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.