How to Create an SQL Statement




(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)



(5.00 out of 5)





How to Create an SQL Statement
Log in to answer.
Copyright © dBuggr LLC - All Rights Reserved.
nishantbaxi 12:38 am on February 12, 2010
Step 1Specify the first clause, the SELECT clause. The SELECT clause is mandatory and identifies which table columns to retrieve from the database. You can identify one or more column names by separating the names by commas. For example:
SELECT city, state
Step 2Add the second clause, the FROM clause, to the statement. The FROM clause is mandatory and specifies the tables in which the table columns are located. You can specify one or more table names by separating the names by commas. In the following example, the FROM clause is added to the SELECT clause and one table name is specified:
SELECT city, state FROM address
Step 3Optionally, include the third clause, which is the WHERE clause. The WHERE clause indicates which table rows to access. Use this clause to filter the rows that were selected from the table by the FROM clause. If you do not include the WHERE clause, all rows will be returned. For example:
SELECT city, state FROM address WHERE city = ‘Philadelphia’
In the above example, the SELECT statement will retrieve database rows where the city equals Philadelphia.