ExamNotes.net  -  IT certification portal

ForumsCertResearchTop sitesNewslettersFree email
HomeRegister
Exams Notes
Practice exams
Exam games
Questions by email
Online training
Training videos
College degrees
Boot camps
Book store
Links directory
Tell a friend
For webmasters

CompTIA Exam Vouchers
Save money on CompTIA exams
Question of the day
Sign up to receive
interactive practice questions
for MCSE, CompTIA
Cisco and other exams
TestKing
Get MCSE, MCSD, CCNA, CCNP,A+, N+ and many more

* ExamSheets *
Guide for Success!
Actual Questions & Answers
MCSE, MCSD, A+ ,CCNA, CCNP
Oracle 8i, Oracle 9i

Online practice tests

Certification sites

Online university

Online college

Online education

Distance learning

Software forum

Server administration forum

Programming resources






This is interesting: Free IT Magazines | Databases help forum



Microsoft (MCSE, MCSD, MOUS, MCAD) > SQL server exams > Question about aliases

Show a Printable Version
Email This Page to Someone!
Receive updates to this thread




Click here for list of SQL 2000 study guides



Author Question about aliases
sjgross
Junior Member
F




Registered: Nov 2002
Location:
Country: United States
State:
Certifications:
Working on: MCP, MCDBA

Total Posts: 29
Question about aliases

Hi folks,

In studying aliases I have the following query from the MS training guide

use northwind
select top 2 * from [Order Details]
select OrdD1.OrderID AS OrderID,

SUM(OrdD1.Quantity) AS "Units Sold",
SUM(OrdD1.UnitPrice * OrdD1.Quantity) AS Revenue

My question is in the second SUM statement where it says OrdD1.Quantity should it not be referred to as Units Sold?

Or is it different because the whole statement in the parentheses (OrdD1.UnitPrice * OrdD1.Quantity) is being assigned as the alias?

__________________
Best,

Susan
My Weblog about studying for MS 70-229 (Notes and Links)
http://ix.1sound.com/dbagirl

Report this post to a moderator

Old Post 02-06-03 05:01 PM
sjgross is offline Click Here to See the Profile for sjgross Click here to Send sjgross a Private Message Add sjgross to your buddy list Find more posts by sjgross Reply w/Quote Edit/Delete Message IP: Logged
MKSD
Junior Member
M




Registered: Jan 2003
Location: London
Country: United Kingdom
State:
Certifications: MCPx12, MCAD, MCSD/MCSD.Net
Working on: MCDBA

Total Posts: 3

Hi,
You're mostly correct, i.e. the sum of (price times quantity) - not just the parenthesis but the whole summing operation on the multiplied result of (P*Q).
The "quotes" are used because there is a space in the column alias, the Revenue Alias is really required because without it you would have no column name in the resultset.
Aliasing is particularly useful to rename a column, provide a name where there isn't one, and also in cases where results are joined from multiple tables with the same column name, for example you may have two tables with an identically-named column (e.g. 'Sales'), you may alias the Sales columns as Domestic, and Export respectively, or whatever is appropriate to distinguish them.
The sample you're referring to demonstrates that you can alias an existing name, or provide one where there is none. I'm overstating the case here, sorry its an occupational hazard ;-)

HTH,

Martin

Report this post to a moderator

Old Post 02-06-03 08:54 PM
MKSD is offline Click Here to See the Profile for MKSD Click here to Send MKSD a Private Message Add MKSD to your buddy list Find more posts by MKSD Reply w/Quote Edit/Delete Message IP: Logged
naresh_sky
Member
M




Registered: Sep 2002
Location:
Country: India
State:
Certifications: 70-228(MCP)
Working on: MCDBA,MCAD,MCSD.NET

Total Posts: 84

Hi susan,MKSD.

I agree with MKSD.
aliasing is also used when ur using the
self join based on a column where in u
give alias to join .

Cheer's
Naresh

Report this post to a moderator

Old Post 02-10-03 01:16 PM
naresh_sky is offline Click Here to See the Profile for naresh_sky Click here to Send naresh_sky a Private Message Add naresh_sky to your buddy list Find more posts by naresh_sky Reply w/Quote Edit/Delete Message IP: Logged
All times are GMT.
Post new thread   Post reply

MCSE exam notes



Forum Jump:
Rate This Thread:
Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is ON.
 

ExamNotes forum archive


Powered by: vBulletin 2.2.8
Copyright ©2000, Jelsoft Enterprises Limited.

  Free Braindumps | mcse braindumps