i have just had to go into the backend of an old site to fix the mysql db as some had deleted the wrong db. i have got most of it working again now but did not know what this line of code is doing.

$sql = "SELECT id,thumb,image,designer,title,(total/freq) AS score FROM shirts ORDER BY score DESC";

i know it is telling it to select the information out of the table and from which table but i have not used the AS condition before and i cannot find an explanation of this anywhere.

if someone could point me in the direction of a good explanation of how this condition effects the sql statement that would be great

9 Years
Discussion Span
Last Post by kevin wood

found out what it means now it is pseudo names for the columns. What it does is gives the names of the columns being used more suitable names to make it easier for people to know what data the column is holding when displaying the information


from what i was reading what it does is, say if you had a column called cust_num and wanted to display this to someone who has not set the table up and did not know what the column names where for or what they meant you would use the AS function to give the column names a more understandable name like customer numbers instead of cust_num.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.