SQL – SELECT part I
I’ve been working on the second SQL Course which focus on SELECT statements.
Like a newly built network environment or Active Directory forest, SQL’s day-to-day work is more of a routine work and less of the creative side. SELECT for SQL is like the show command in a Cisco IOS – simple but powerful, flexible and by far the most used command.
Definition: SELECT statement retrieves rows from the database and enables the selection of one or many rows or columns from one or many tables.
The main syntax options for the SELECT statement are:
SELECT select_list [ INTO new_table ]
[ FROM table_source ] [ WHERE search_condition ]
[ GROUP BY group_by_expression ]
[ HAVING search_condition ]
[ ORDER BY order_expression [ ASC | DESC ] ]
FROM is the only mandatory option (you must point the statement to a table). Use the other options at your will to filter the retrieved data and sort it in a user-friendly way.