SQL SELECT Statement

The SQL SELECT syntax

The general syntax is:

  1. SELECT columnnames
  2. FROM tablename

To select all columns use *

  1. SELECT *
  2. FROM tablename

 


 

SQL SELECT Examples

Problem: List all customers

  1. SELECT *
  2. FROM Customer

Results:  91 records

Id FirstName LastName City Country Phone
1 Maria Anders Berlin Germany 030-0074321
2 Ana Trujillo México D.F. Mexico (5) 555-4729
3 Antonio Moreno México D.F. Mexico (5) 555-3932
4 Thomas Hardy London UK (171) 555-7788
5 Christina Berglund Luleå Sweden 0921-12 34 65

 


Problem: List the first name, last name, and city of all customers

  1. SELECT FirstName, LastName, City
  2. FROM Customer

Results:  91 records

FirstName LastName City
Maria Anders Berlin
Ana Trujillo México D.F.
Antonio Moreno México D.F.
Thomas Hardy London
Christina Berglund Luleå

“SQL SELECT Statement”의 8개의 댓글

  1. I have been exploring for a little for any high quality articles or weblog posts on this kind of space .
    Exploring in Yahoo I at last stumbled upon this website.
    Reading this information So i’m happy to express that I’ve an incredibly just right uncanny feeling I discovered
    just what I needed. I such a lot no doubt will make sure to don?t overlook this website and provides it
    a glance on a relentless basis.

  2. I just want to tell you that I’m all new to blogging and site-building and actually enjoyed your blog. Likely I’m likely to bookmark your site . You surely have fabulous well written articles. Thanks a lot for sharing with us your web page.

  3. you are actually a just right webmaster. The site loading speed is
    amazing. It kind of feels that you’re doing any distinctive trick.

    Also, The contents are masterpiece. you’ve performed a wonderful task on this topic!

댓글 남기기