The SQL Alias syntax
The general syntax is:
- SELECT column–name AS alias–name
- FROM table–name alias–name
- WHERE condition
SQL Alias Examples
Problem: List total customers in each country.
Display results with easy to understand column headers.
- SELECT COUNT(C.Id) AS TotalCustomers, C.Country AS Nation
- FROM Customer C
- GROUP BY C.Country
TotalCustomers and Nation are column aliases.
The table alias (C) in this example is not particularly useful.
Results: 21 records
TotalCustomers | Nation |
---|---|
3 | Argentina |
2 | Austria |
2 | Belgium |
9 | Brazil |
3 | Canada |
![]() |
Problem: List the total amount ordered by customer
with easy to read column headers
- SELECT C.Id AS Identifier, C.LastName + ‘, ‘ + C.FirstName AS CustomerName,
- SUM(O.TotalAmount) AS TotalSpent
- FROM [Order] O JOIN Customer C ON O.CustomerId = C.Id
- GROUP BY C.Id, C.LastName + ‘, ‘ + C.FirstName
- ORDER BY TotalSpent DESC
The aliases significantly simplify writing the JOIN and ORDER BY clauses.
The C alias in C.Id helps identify the Customer Id rather then the Order Id.
Results: 89 records
Identifier | CustomerName | TotalSpent |
---|---|---|
63 | Kloss, Horst | 117483.39 |
71 | Pavarotti, Jose | 115673.39 |
20 | Mendel, Roland | 113236.68 |
37 | McKenna, Patricia | 57317.39 |
65 | Wilson, Paula | 52245.90 |
Pingback: w88club
Pingback: mơ thấy con cá đánh đề con gì
Pingback: Pomsky puppies for sale near me
Pingback: f1b labradoodles for sale
Pingback: mơ thấy người cha đã mất
win money free
buy domain name free
Pingback: fun88
Pingback: mo thay ran can
Pingback: mơ thấy cứu người chết đuối
Pingback: đeo kim cương có may mắn không
Pingback: mơ cá chép đánh con gì
Pingback: dơi bay vào nhà báo điềm gì
Pingback: mơ đánh vợ
Pingback: mơ thấy biển số xe danh con gi
Pingback: mơ bị đòi nợ đánh con gì
Pingback: mơ đi xe đạp đánh con gì
Pingback: dwayne johnson
Pingback: chiem bao thay di chua
Pingback: Benefits of Intelligent Automation
Pingback: mơ thấy bàn thờ tổ tiên
Pingback: buy dumps online
Pingback: นิยายจีนแปลไทย
Pingback: safe black ops cold war cheats
Pingback: bị bọ cạp cắn
Pingback: mơ thấy đầu người
Pingback: dumps track 2 shop
Pingback: css image align
Pingback: nằm mơ thấy hôn môi
Pingback: nằm mơ thấy ốc đánh con gì
Anja
Vicki
Carson
layarkaca21 indonesia
Shella
RevSkin Cream
layarkaca21 xxi
Pingback: http://95.111.232.179/
Pingback: ตู้แปลภาษา
Pingback: mơ thấy mất của
Pingback: con sau so may
Pingback: nằm mơ thấy ngựa đánh số gì
Pingback: những cách tỏ tình lãng mạn
Pingback: sự tôn trọng trong tình yêu
Pingback: mơ thấy bướm phụ nữ
Pingback: http://95.111.232.180/
free dating online
windows 8 activator cmd
windows loader latest version free download
windows loader win 10
windows loader modified remove other cracks
Graham Sicotte
Osvaldo Segler
Amos Schiveley
Dallas Yadao
Jesusita Routt
Bobbi Klamet
Bennett Blackstad
Candi Tuberville
Delbert Calvino
Otha Lindwall
Shizuko Mccaig
Darrel Roblee
Fatima Nobregas
Lauren Shimanuki
Rhonda Verbridge
Terrilyn Olivencia
Hunter Swanston
Tomiko Hrbacek
Cameron Mcclimon
Kelli Mchaffie
Brian Stockhoff
Reyna Willson
Enedina Ragains
Chung Erbentraut
www38.tok2.com
miyu0914.s31.xrea.com
0mniartist
asmr https://0mniartist.tumblr.com
asmr https://0mniartist.tumblr.com
bitly.com
http://bitly.com/
rantsforchange.ca
http://www.lagrandefamiglia.it
www.fotosombra.com.br
www.makemoneydonothing.com
http://xajm168.com/forum.php?mod=viewthread&tid=116123
www.fotosombra.com.br
atomy123.cn
gamefly on
http://exterminatorsouthflorida.com/
why asmr
asmr this
asmr a
frun-test.sakura.ne.jp
http://www.qzzer.cn/
for gamefly
asmr it
tinyurl.com
asmr our
asmr for
http://39.100.90.4/bbs/forum.php?mod=viewthread&tid=731689
익명
http://www.ptfang.com/
http://tinyurl.com/
http://tinyurl.com/yjplmdpf
bit.ly
https://785days.tumblr.com/
off asmr
of dating sites
their dating sites
scoliosis when
www.fles.hlc.edu.tw
scoliosis surgery but
free dating sites or
it dating sites
tinyurl.com
tinyurl.com
tadalafil dosage
tadalafil max dose
40 mg tadalafil
tadalafil 40
tadalafil tablets
tadalafil daily use
tadalafil tablets
generic tadalafil
tadalafil 30 mg
tinyurl.com
http://tinyurl.com/
tinyurl.com
tinyurl.com
tinyurl.com
bit.ly
gamefly it
ps4 games with
ps4 games my
or ps4 games
for scoliosis surgery
bit.ly
http://tinyurl.com
what scoliosis surgery
instagram takipçi satın al
what quest bars
app.gumroad.com
tinyurl.com
coub.com
http://bit.ly/3k0xFd5
bitly.com
iherb.com
Pingback: Temp Email
ps4 games your
what ps4 games
college format essay
was asmr
hayvan fotoğrafları