SQL Alias

The SQL Alias syntax

The general syntax is:

  1. SELECT columnname AS aliasname
  2. FROM tablename aliasname
  3. WHERE condition

 


 

SQL Alias Examples

Problem: List total customers in each country.
Display results with easy to understand column headers.

  1. SELECT COUNT(C.Id) AS TotalCustomers, C.Country AS Nation
  2. FROM Customer C
  3. 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

  1. SELECT C.Id AS Identifier, C.LastName + ‘, ‘ + C.FirstName AS CustomerName,
  2. SUM(O.TotalAmount) AS TotalSpent
  3. FROM [Order] O JOIN Customer C ON O.CustomerId = C.Id
  4. GROUP BY C.Id, C.LastName + ‘, ‘ + C.FirstName
  5. 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

Comments (149)

  1. Pingback: w88club

  2. Pingback: mơ thấy con cá đánh đề con gì

  3. Pingback: Pomsky puppies for sale near me

  4. Pingback: f1b labradoodles for sale

  5. Pingback: mơ thấy người cha đã mất

  6. Pingback: fun88

  7. Pingback: mo thay ran can

  8. Pingback: mơ thấy cứu người chết đuối

  9. Pingback: đeo kim cương có may mắn không

  10. Pingback: mơ cá chép đánh con gì

  11. Pingback: dơi bay vào nhà báo điềm gì

  12. Pingback: mơ đánh vợ

  13. Pingback: mơ thấy biển số xe danh con gi

  14. Pingback: mơ bị đòi nợ đánh con gì

  15. Pingback: mơ đi xe đạp đánh con gì

  16. Pingback: dwayne johnson

  17. Pingback: chiem bao thay di chua

  18. Pingback: Benefits of Intelligent Automation

  19. Pingback: mơ thấy bàn thờ tổ tiên

  20. Pingback: buy dumps online

  21. Pingback: นิยายจีนแปลไทย

  22. Pingback: safe black ops cold war cheats

  23. Pingback: bị bọ cạp cắn

  24. Pingback: mơ thấy đầu người

  25. Pingback: dumps track 2 shop

  26. Pingback: css image align

  27. Pingback: nằm mơ thấy hôn môi

  28. Pingback: nằm mơ thấy ốc đánh con gì

  29. 응답

    Howdy! I know this is somewhat off topic but I was wondering which blog platform are
    you using for this site? I’m getting tired of WordPress because I’ve had problems with hackers and I’m looking at options for another platform.
    I would be fantastic if you could point me in the
    direction of a good platform.

  30. 응답

    Pretty nice post. I just stumbled upon your blog and wished to say
    that I have truly enjoyed browsing your blog posts.
    In any case I will be subscribing to your rss feed and I hope you
    write again very soon!

  31. 응답

    Thanks for any other informative site. Where else
    may I get that kind of information written in such a perfect way?

    I’ve a undertaking that I’m simply now running on, and I have been on the glance out for such info.

  32. 응답

    Wow, amazing weblog format! How lengthy have you been running a blog for?

    you make blogging look easy. The entire look of your website is fantastic, let alone the content!

  33. 응답

    I’m not that much of a internet reader to be honest but your sites really nice, keep it up!
    I’ll go ahead and bookmark your site to come back in the future.
    Many thanks

  34. Pingback: http://95.111.232.179/

  35. Pingback: ตู้แปลภาษา

  36. Pingback: mơ thấy mất của

  37. Pingback: con sau so may

  38. Pingback: nằm mơ thấy ngựa đánh số gì

  39. Pingback: những cách tỏ tình lãng mạn

  40. Pingback: sự tôn trọng trong tình yêu

  41. Pingback: mơ thấy bướm phụ nữ

  42. Pingback: http://95.111.232.180/

  43. 응답

    I think this is among the most vital info for me. And i am glad reading your article. But wanna remark on some general things, The web site style is wonderful, the articles is really nice : D. Good job, cheers|

  44. 응답

    I am extremely impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you customize it yourself? Either way keep up the excellent quality writing, it’s rare to see a great blog like this one these days.|

  45. 응답

    Hi! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?|

  46. 응답

    You’re so interesting! I do not think I’ve read a single thing like this before. So good to discover another person with some genuine thoughts on this issue. Really.. many thanks for starting this up. This site is one thing that is needed on the internet, someone with a little originality!|

  47. 응답

    Woah! I’m really loving the template/theme of this blog. It’s simple, yet effective. A lot of times it’s very difficult to get that “perfect balance” between user friendliness and visual appearance. I must say that you’ve done a very good job with this. In addition, the blog loads extremely fast for me on Chrome. Outstanding Blog!|

  48. 응답

    Hey there! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?|

  49. 응답

    I think this is one of the most vital information for me. And i am glad reading your article. But wanna remark on few general things, The site style is perfect, the articles is really great : D. Good job, cheers|

  50. 응답

    What i do not realize is in reality how you are now not actually much more smartly-preferred than you might be now. You’re very intelligent. You recognize therefore considerably with regards to this matter, produced me for my part imagine it from a lot of numerous angles. Its like men and women don’t seem to be involved unless it’s one thing to accomplish with Lady gaga! Your personal stuffs outstanding. At all times maintain it up!|

  51. 응답

    Thank you for any other informative blog. The place else may just I get that type of info written in such a perfect manner? I’ve a project that I’m simply now operating on, and I’ve been on the look out for such information.|

  52. 응답

    Hiya very nice website!! Guy .. Excellent .. Amazing .. I will bookmark your website and take the feeds additionally? I am satisfied to seek out a lot of helpful info here in the submit, we’d like work out more strategies on this regard, thanks for sharing. . . . . .|

  53. 응답

    What’s up it’s me, I am also visiting this web site on a regular basis, this web page is genuinely fastidious and the viewers are truly sharing good thoughts.|

  54. 응답

    Excellent items from you, man. I’ve understand your stuff previous to and you are just extremely excellent. I actually like what you have obtained right here, certainly like what you’re saying and the best way during which you assert it. You make it enjoyable and you continue to take care of to stay it smart. I can not wait to learn much more from you. This is really a wonderful site.|

  55. 응답

    Greetings! Very helpful advice within this article! It is the little changes that produce the most important changes. Thanks for sharing!|

  56. 응답

    Everything is very open with a really clear description of the challenges. It was definitely informative. Your site is useful. Many thanks for sharing!|

  57. 응답

    It is the best time to make a few plans for the future and it is time to be happy. I’ve learn this publish and if I may I desire to recommend you few interesting things or tips. Perhaps you could write subsequent articles regarding this article. I desire to read more things about it!|

  58. 응답

    Great work! This is the type of info that are supposed to be shared around the internet. Shame on Google for now not positioning this submit higher! Come on over and seek advice from my site . Thank you =)|

  59. 응답

    Hmm is anyone else having problems with the pictures on this blog loading? I’m trying to find out if its a problem on my end or if it’s the blog. Any feedback would be greatly appreciated.|

  60. 응답

    The other day, while I was at work, my sister stole my apple ipad and tested to see if it can survive a forty foot drop, just so she can be a youtube sensation. My apple ipad is now destroyed and she has 83 views. I know this is completely off topic but I had to share it with someone!|

  61. 응답

    This is very fascinating, You are a very skilled blogger. I have joined your rss feed and sit up for in search of extra of your great post. Also, I’ve shared your website in my social networks|

  62. 응답

    Very good blog you have here but I was curious about if you knew of any community forums that cover the same topics discussed in this article? I’d really like to be a part of online community where I can get comments from other experienced individuals that share the same interest. If you have any recommendations, please let me know. Kudos!|

  63. 응답

    Pretty nice post. I just stumbled upon your weblog and wanted to say that I’ve truly
    enjoyed browsing your blog posts. In any case I’ll be subscribing to your
    feed and I hope you write again soon!

    Here is my webpage – Humboldts Best CBD Oil Reviews; www38.tok2.com,

  64. 응답

    What’s Happening i’m new to this, I stumbled upon this I have found It positively useful and it has
    helped me out loads. I’m hoping to contribute & assist different users like its helped me.
    Good job.

    Feel free to visit my blog; Premium Diet Keto Reviews – miyu0914.s31.xrea.com

  65. 응답

    I have read so many articles regarding the blogger lovers however this article is actually a pleasant piece of writing,
    keep it up. asmr 0mniartist

  66. 응답

    I have been surfing online more than three hours lately, but I by no means discovered
    any attention-grabbing article like yours.

    It’s lovely value enough for me. Personally, if all
    web owners and bloggers made just right content as you did, the web
    will be much more helpful than ever before. asmr 0mniartist

  67. 응답

    You could certainly see your expertise in the article you write.
    The sector hopes for even more passionate writers like you
    who aren’t afraid to say how they believe. At all times go after your heart.
    asmr 0mniartist

  68. 응답

    I leave a comment when I appreciate a article on a site or I
    have something to valuable to contribute to the discussion.
    Usually it’s caused by the fire displayed in the article I
    looked at. And on this post SQL Alias | 기록은 자산.
    I was excited enough to drop a thought 😉 I do have a few questions for you if you do not mind.
    Could it be simply me or does it look like like some
    of the remarks appear like written by brain dead visitors?
    😛 And, if you are writing at additional places, I would like to follow you.
    Would you make a list every one of all your shared pages like your linkedin profile, Facebook page
    or twitter feed?

    Also visit my blog … Creek Side CBD – http://www.lagrandefamiglia.it,

  69. 응답

    Just want to say your article is as surprising. The clarity in your
    post is simply cool and i could assume you are an expert on this subject.

    Well with your permission allow me to grab your
    feed to keep up to date with forthcoming post. Thanks a
    million and please keep up the gratifying work.

    My site: Pure Remedy CBD Reviews; http://www.fotosombra.com.br,

  70. 응답

    This is the perfect web site for anybody who really wants to understand this topic.
    You know so much its almost hard to argue with you (not that I actually
    will need to?HaHa). You definitely put a new spin on a topic
    that’s been discussed for years. Wonderful stuff,
    just great!

    Also visit my web-site :: Creek Side CBD (http://www.makemoneydonothing.com)

  71. 응답

    Howdy, i read your blog occasionally and i own a similar one and i
    was just wondering if you get a lot of spam remarks?
    If so how do you protect against it, any plugin or anything you can recommend?
    I get so much lately it’s driving me crazy so any assistance is very much appreciated.

  72. 응답

    I’ll immediately clutch your rss as I can’t find your e-mail subscription link or e-newsletter service.

    Do you’ve any? Please let me realize so that I could subscribe.
    Thanks.

  73. 응답

    It is appropriate time to make some plans for the future and it is time to be
    happy. I have read this post and if I could I want to suggest you some interesting things or tips.
    Maybe you can write next articles referring to this article.
    I want to read even more things about it!

  74. 응답

    I don’t even understand how I ended up right here, however I believed this submit used to be good.
    I do not realize who you might be but definitely you are going to a well-known blogger if you happen to
    aren’t already. Cheers!

  75. 응답

    Hello Dear, are you really visiting this website regularly, if so
    afterward you will without doubt take fastidious
    experience.

  76. 응답

    Hello very nice web site!! Guy .. Excellent .. Superb ..
    I’ll bookmark your blog and take the feeds additionally?
    I’m happy to find so many helpful information here
    in the put up, we’d like develop extra techniques in this
    regard, thank you for sharing. . . . . .

  77. 응답

    This is the perfect webpage for anyone who wishes to understand this
    topic. You know a whole lot its almost hard to argue with you (not that
    I really would want to…HaHa). You certainly put a
    new spin on a topic that’s been written about for many years.
    Great stuff, just wonderful!

  78. 응답

    Wow, wonderful weblog format! How long have you ever been running a blog for?
    you made blogging look easy. The overall
    glance of your web site is wonderful, as well as the
    content material!

  79. 응답

    We are a bunch of volunteers and starting a new scheme in our community.
    Your web site provided us with helpful info to paintings on. You’ve done
    an impressive process and our whole community will be thankful to you.

    Look into my blog post; Sophria Anti Aging Cream Review (http://www.ptfang.com/)

  80. 응답

    scoliosis
    It’s actually a cool and useful piece of info.
    I’m happy that you shared this helpful information with
    us. Please stay us informed like this. Thanks
    for sharing. scoliosis

  81. 응답

    excellent post, very informative. I’m wondering why the
    opposite specialists of this sector do not notice this.
    You should continue your writing. I’m confident,
    you’ve a huge readers’ base already!

  82. 응답

    Thank you a lot for sharing this with all of us you really understand what you are
    talking approximately! Bookmarked. Please also talk over
    with my website =). We may have a link exchange arrangement among us

  83. 응답

    Wonderful site. Lots of useful information here.
    I’m sending it to some buddies ans also sharing in delicious.
    And obviously, thanks in your effort!

  84. 응답

    Good day very cool web site!! Man .. Beautiful .. Amazing ..
    I’ll bookmark your site and take the feeds additionally…I’m satisfied to find numerous useful info right here within the put up, we’d like work
    out more strategies on this regard, thank you for sharing.

    Look at my blog post: Bio Wellness CBD (http://www.fles.hlc.edu.tw)

  85. 응답

    I don’t know whether it’s just me or if perhaps everyone else experiencing problems with your website.
    It appears like some of the written text within your content are running off the screen. Can somebody else please provide feedback
    and let me know if this is happening to them as well?

    This may be a issue with my internet browser because
    I’ve had this happen before. Appreciate it

  86. 응답

    hey there and thank you for your information – I have definitely picked
    up something new from right here. I did however expertise several technical issues using this web site,
    since I experienced to reload the website many times previous to
    I could get it to load correctly. I had been wondering if your web hosting is OK?
    Not that I’m complaining, but sluggish loading instances
    times will sometimes affect your placement
    in google and can damage your high quality score if advertising and marketing with Adwords.
    Well I am adding this RSS to my email and could look out
    for much more of your respective fascinating content.

    Ensure that you update this again very soon.

  87. 응답

    Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You obviously know what youre talking about, why throw away
    your intelligence on just posting videos to your weblog when you could be giving us something enlightening to read?

  88. 응답

    Thanks for your marvelous posting! I definitely enjoyed reading it,
    you may be a great author.I will be sure to bookmark your blog and definitely
    will come back in the foreseeable future. I want to encourage yourself to
    continue your great job, have a nice day!

  89. 응답

    What’s up i am kavin, its my first time to commenting anywhere, when i read
    this post i thought i could also create comment
    due to this sensible piece of writing.

  90. 응답

    Hi to every body, it’s my first pay a visit of this blog; this
    website contains remarkable and in fact excellent data in favor of readers.

  91. 응답

    Why people still use to read news papers when in this technological
    world the whole thing is available on net?

  92. 응답

    You can definitely see your enthusiasm within the article
    you write. The world hopes for even more passionate writers such as you who are not afraid
    to say how they believe. All the time follow your heart.

  93. 응답

    I’m impressed, I have to admit. Rarely do I encounter a blog that’s both equally
    educative and interesting, and let me tell you, you have
    hit the nail on the head. The issue is something too few men and women are speaking intelligently about.
    Now i’m very happy that I found this during my hunt for something relating to this.

  94. 응답

    Hey I know this is off topic but I was wondering if you knew of any
    widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this
    for quite some time and was hoping maybe you would
    have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

  95. 응답

    I know this if off topic but I’m looking into starting
    my own blog and was curious what all is needed to get set up?
    I’m assuming having a blog like yours would cost a pretty
    penny? I’m not very internet smart so I’m not 100%
    sure. Any suggestions or advice would be greatly appreciated.
    Thanks

  96. 응답

    This is very interesting, You are a very skilled blogger.
    I’ve joined your feed and look forward to seeking more
    of your fantastic post. Also, I have shared your web site in my social networks!

  97. 응답

    I’m not sure where you are getting your information, but great topic.
    I needs to spend some time learning more or understanding more.
    Thanks for fantastic info I was looking for this information for my
    mission.

  98. 응답

    Hello there! This post could not be written any better!

    Reading this post reminds me of my good old room mate!
    He always kept chatting about this. I will forward this page to him.
    Fairly certain he will have a good read. Thanks for
    sharing! scoliosis surgery https://0401mm.tumblr.com/ scoliosis
    surgery

  99. 응답

    Hmm it seems like your website ate my first comment
    (it was extremely long) so I guess I’ll just sum it up what I submitted and say,
    I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to
    the whole thing. Do you have any points for newbie blog writers?
    I’d definitely appreciate it. ps4 games https://bitly.com/3z5HwTp ps4 games

Leave a comment

이메일 주소는 공개되지 않습니다.