View Single Post
Old 03-31-2006, 12:19 PM   #11 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,529
sde is on a distinguished road
great glad i could help.

count() is a mysql function that returns the number of rows found in your query. you can find out other mysql functions by looking through their documentation. there are a lot of other helpful database functions that you will need to use from time to time. count is one of the more common ones though.

the abbreviations for the table names are just that, abreviations.

Take this query for example:
Code:
select c.id, p.number from customers as c
  left join phone_numbers as p on c.id=p.customer_id
  where c.id=153
You have a customer table, and a phone numbers table with a 1 to many relationship. We are simply selecting all the phone numbers for customer id 153. The abbreviation just makes it less to type.

Below is the same query without abbreviations:
Code:
select customer.id, phone_numbers.number
  from customers, phone_numbers
  left join customers on customers.id=phone_numbers.customer_id
  where customers.id=153
it's a little more typing. it's nice to only have to type the table name once, and then use 1 letter to reference it later in the query.
sde is offline   Reply With Quote