Tuesday 28 August 2012

SELECT statement

Most basic SQL command, allows us to retrieve data from the database.
SELECT
Specifies which columns are to appear in output
FROM
Specifies table to be used
WHERE Filters rows
GROUP BY
Forms groups of rows with same column value
HAVING
Filters groups subject to some condition
ORDER BY
Specifies the order of the output


Format
SELECT <list of attribute> FROM <source table>;

Select all from a table
SELECT * FROM table;

Select a few attributes from a table 
SELECT attribute1, attibute2 FROM table;

Examples
SELECT * FROM Gamez;
SELECT game_name, genre, console FROM Gamez;

No comments:

Post a Comment