Long description

Back

Statement 1: SELECT I S B N 10 comma Title FROM Books. SELECT is labeled SQL keyword that indicates the type of query (in this case a query to retrieve data). I S B N 10 comma Title is labeled Fields to retrieve. FROM is labeled SQL keyword for specifying the tables. Books is labeled Table to retrieve from.

Statement 2: SELECT asterisk FROM Books. Asterisk is labeled Wildcard to select all fields. Note: While the wildcard is convenient, especially when testing, for production code it is usually avoided; instead of selecting every field, you should select just the fields you need.

Statement 3: select i S b N 10 comma title FROM BOOKS ORDER BY title. ORDER BY is labeled SQL keyword to indicate sort order. Title is labeled Field to sort on. Note: SQL doesn’t care if a command is on a single line or multiple lines, nor does it care about the case of keywords or table and field names. Line breaks and keyword capitalization are often used to aid in readability.

Statement 4: SELECT I S B N 10 comma Title FROM Books ORDER BY CopyrightYear DESC comma Title ASC. CopyrightYear DESC comma Title ASC is labeled Several sort orders can be specified: in this case the data is sorted first on year, then on title. DESC and ASC are collectively labeled Keywords indicating that sorting should be in descending or ascending order (which is the default).

Back