메뉴 닫기

SQL SELECT TOP Statement

The SQL SELECT TOP syntax

The general syntax is:

  1. SELECT TOP n columnnames
  2. FROM tablename

 


 

SQL SELECT TOP

Problem: List top 10 most expensive products

  1. SELECT TOP 10 Id, ProductName, UnitPrice, Package
  2. FROM Product
  3. ORDER BY UnitPrice DESC

Results: 10 records.

Id ProductName UnitPrice Package
38 Côte de Blaye 263.50 12 – 75 cl bottles
29 Thüringer Rostbratwurst 123.79 50 bags x 30 sausgs.
9 Mishi Kobe Niku 97.00 18 – 500 g pkgs.
20 Sir Rodney’s Marmalade 81.00 30 gift boxes
18 Carnarvon Tigers 62.50 16 kg pkg.
59 Raclette Courdavault 55.00 5 kg pkg.
51 Manjimup Dried Apples 53.00 50 – 300 g pkgs.
62 Tarte au sucre 49.30 48 pies
43 Ipoh Coffee 46.00 16 – 500 g tins
28 Rössle Sauerkraut 45.60 25 – 825 g cans

10 Comments

  1. no g

    Oh my goodness! Awesome article dude! Thank you, However I am going through issues with your RSS.
    I don’t know why I am unable to subscribe to it.
    Is there anyone else getting the same RSS issues?
    Anyone that knows the solution will you kindly respond?
    Thanx!!

  2. g https://tinyurl.com/rsacwgxy

    Hi! This is kind of off topic but I need some guidance from an established blog.
    Is it difficult to set up your own blog? I’m
    not very techincal but I can figure things out pretty fast.
    I’m thinking about creating my own but I’m not sure where to begin. Do you have any
    tips or suggestions? Many thanks

  3. webhosting

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

댓글 남기기

이메일은 공개되지 않습니다.