• Home
  • Tutorials
  • Video Tutorials
  • External Tutorials

XtremeSkill.com

Browse XTREME

Home
Tutorials
Video Tutorials
External Tutorials
Submit

Browse Tutorials

  • HTML Tutorials
  • Adobe Illustrator Tutorials  
  • Maya Tutorials  
  • 3d Studio max  
  • Flash  
  • Adobe Photoshop Tutorials 

Friends

Surreal GFX.com

 
GrandWallpapers.com
 
FinalPrestige.net
 

 


Special SQL commands Tutorials ,Learn SQL PDF Print E-mail


here are some of most widely used and very important sql commands:

Table Store_Information

store_name Sales Date
Los Angeles $1500 Jan-05-1999
San Diego $250 Jan-07-1999
Los Angeles $300 Jan-08-1999
Boston $700 Jan-08-1999

We shall use this table as an example throughout the tutorial (this table will appear in all sections). To select all the stores in this table, we key in,

SELECT store_name FROM Store_Information

Result:

store_name
Los Angeles
San Diego
Los Angeles
Boston

Multiple column names can be selected, as well as multiple table names.

The SELECT keyword allows us to grab all information from a column (or columns) on a table. This, of course, necessarily mean that there will be redundancies. What if we only want to select each DISTINCT element? This is easy to accomplish in SQL. All we need to do is to add DISTINCT after SELECT. The syntax is as follows:

SELECT DISTINCT "column_name"
FROM "table_name"

For example, to select all distinct stores in Table Store_Information,

Table Store_Information

store_name Sales Date
Los Angeles $1500 Jan-05-1999
San Diego $250 Jan-07-1999
Los Angeles $300 Jan-08-1999
Boston $700 Jan-08-1999

we key in,

SELECT DISTINCT store_name FROM Store_Information

Result:

store_name
Los Angeles
San Diego
Boston

SQL WHERE :

Next, we might want to conditionally select the data from a table. For example, we may want to only retrieve stores with sales above $1,000. To do this, we use the WHERE keyword. The syntax is as follows:

SELECT "column_name"
FROM "table_name"
WHERE "condition"

 

For example, to select all stores with sales above $1,000 in Table Store_Information,

Table Store_Information

store_name Sales Date
Los Angeles $1500 Jan-05-1999
San Diego $250 Jan-07-1999
Los Angeles $300 Jan-08-1999
Boston $700 Jan-08-1999

we key in,

SELECT store_name
FROM Store_Information
WHERE Sales > 1000


Result:

store_name
Los Angeles

 

 


Comments
Search
Only registered users can write comments!
Powered by !JoomlaComment 3.26

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 
< Prev
[ Back ]

http://xtremeskill.com, Powered by Joomla! and designed by SiteGround web hosting