CodeTeller.com

Home   About us   Site Map
 
 
 
SQL Home | PHP Home  | Linux Home  |  Javascript Home  | HTML Home  | Perl Home  | Python Home  | ASP Home | 
  SQL Tutorials
SQL SELECT
SQL DISTINCT
SQL WHERE
SQL AND OR
SQL IN
SQL JOBS
SQL BETWEEN
SQL LIKE
SQL ORDER BY
SQL FUNCTIONS
SQL COUNT
SQL GROUP BY
SQL HAVING
SQL ALIAS
SQL JOIN
SQL OUTER JOIN
SQL CONCATENATE
SQL SUBSTRING
SQL TRIM
SQL CREATE TABLE
SQL CONSTRAINT
SQL PRIMARY KEY
SQL FOREIGN KEY
SQL CREATE VIEW
SQL CREATE INDEX
SQL ALTER TABLE
SQL DROP TABLE
SQL TRUNCATE TABLE
SQL INSERT INTO
SQL DELETE FROM

  
  SQL SELECT

What do we use SQL commands for? A common use is to select data from the tables located in a database. Immediately, we see two keywords: we need to SELECT informationFROM a table. (Note that a table is a container that resides in the database where the data is stored. For more information about how to manipulate tables, go to the Table Manipulation Section. Hence we have the most basic SQL structure:

SELECT "column_name" FROM "table_name"

To illustrate the above example, assume that we have the following table:

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


   Next>>
 
 
Home  |  About us  | Privacy  |  Disclaimer  |  Contact us |  Advertise with us | Our other channels