First: I believe this is not legal (looking at myySQL manual p 6.5.3):
PRIMARY KEY (key1), KEY (key2)
You may use one or the other.

Second: You may search by either owner_id or customer_id without creating an
index.
Such as:  SELECT * FROM mytable WHERE owner_id=123;

-----Original Message-----
From: Federico Schwindt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 31, 2001 3:57 PM
To: [EMAIL PROTECTED]
Subject: key question


hi,

  i'm not sure if this belongs here, but i cannot seem to find the
answer anywhere else.
  first, what's the difference between:

  PRIMARY KEY (key1, key2)
  PRIMARY KEY (key1), KEY (key2)

  second, let's suppose the following table:

  owner_id int(11),
  customer_id int(11),
  customer_info varchar(100)

  and i want to search either by owner_id and customer_id.
  can i do this w/o creating the indexes by hand? or do i have to
create'em explicity and specify which one i'm gonna use before
performing a query?
  if anyone can help me or point me to where i can find this kind of
stuff i'd appreciate it.
  thanks,

  f.-

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to