,ch03.13605 Page 133 Wednesday, November 29, 2000 4:42
,ch03.13605 Page 133 Wednesday, November 29, 2000 4:42 PM ALL is the default, meaning all records are returned, including defaults. DISTINCT is a keyword that tells the query to filter out all duplicate records. Thus, the result set includes only one instance of identical records. There are several other rules for what can appear in the SELECT item list: Most commonly, all the columns desired should be listed out using a comma between each one. An asterisk (*) serves as shorthand to retrieve all the columns in every table shown in the FROM clause, as they are listed in the CREATE TABLE statement. Column aliases are added in to replace the default column headings used in the results. Use the format column AS alias or column alias. This is especially useful when a column heading is too cryptic or lengthy to be readily understood. For example: — alias format SELECT au_lname AS “Last Name” FROM authors — alternative alias format SELECT au_lname “Last Name” FROM authors Local and global variables, where supported, may appear as a select list item. Comments may be dispersed throughout any SQL or Transact-SQL statement by using either the double-dash (–) or the slash-asterisk (/* … */ ). The double-dash causes the query to ignore any text that follows the double-dash until the end of line. The slash causes the query to ignore any text within the slash-asterisk and inverse slash-asterisk. The table name should be prefixed to the column name in a query using multiple tables. Technically, the table name needs to apply to any column in both tables; it is commonly considered good practice to do so anyway. For example, both the jobs and employee tables contain the job_id column: SELECT employee.emp_id, employee.fname, employee.lname, jobs.job_desc FROM employee, jobs WHERE employee.job_id = jobs.job_id ORDER BY employee.fname, employee.lname The schema or owner name should be prefixed to a column when extracted from a context outside of the current user. If the table is owned by another username, then the username must be included in the column reference. For example, assume that this example query is run in the PUBS database but also retrieves data from the SALES database: SELECT employee.emp_id, salesadmin.sales_summary.total_amt Statements SELECT 133
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services