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
);

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.