Hi Bob,
Many thanks for your answer, I was afraid that
due to the length of the mail, it would scare
everybody...
>>Battery:
>>* batID (primary key)
>>* makID
>>* descr
>>
>>Maker:
>>* makID (primary key)
>>* mak
>A battery can have only one manufacturer, so you might as well add
>the mak column to Battery and remove Maker.
Well, the idea was not repeating the name of the maker,
just have its ID.
>>Special:
>>* speID (primary key)
>>* special
>>
>>Bat_Spe:
>>* batID
>>* speID (both in primary key)
>>
>>Tipical:
>Do you mean Type?
Well, in fact I mean Typical (typical application of the battery)
>>* tipID (primary key)
>>* tipical
>>
>>Bat_Tip:
>>* batID
>>* tipID (primary key)
In fact it is like for join table Bat_Spe:
* tipID (both in primary key)
>>QUESTION:
>>Is there any difference between
>>* SELECT batID, count(speID)
>>* SELECT batID, count(batID)
>>* SELECT batID, count(*) ?
>>In this case, the three work and return the same result.
>In the future, if you decide to change the WHERE clause to search for
>two or more speIDs (e.g. WHERE speID = 'speA' OR speID = 'speB'),
>then the counts will be different. Decide what you actually want to
>count; speIDs, batteries, or rows. Even if the WHERE clause doesn't
>change, what you count gives you a clue as to what the statement
>does. Suppose you want to count rows and you use count(batID). Six
>months from now when you've forgotten how this works, the use of
>count(batID) will make it more difficult to figure out that you are
>counting rows.
I think I was confused because each couple (speID, batID)
is unique. That's why the 3 forms are equivalent here.
For the last question, (list of characteristics for each
battery matched) I decided to make a query for each
class of characteristics ('spe', 'tip') since I wanted to
do some additional treatments.
Thanks again Bob, I feel more confident now.
Olivier
---------------------------------------------------------------------
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