Chapter Three – Structured Query Language
• Some SQL keywords, such as DISTINCT and GROUP BY with HAVING are
easier to key into the SQL View window than to remember how to do it in
Microsoft Access
• If you want to construct SQL programmatically, which is common, especially with
SQL SELECT and ADO.NET or PHP, you must know SQL.
• If you are using Microsoft Access, you can use it as a teaching tool. Have the
students use the graphical facility for creating a query and then right click in the top
frame of the query window and select SQL View. They can then check how Microsoft
Access interpreted their query and learn SQL syntax in the process.
• Microsoft Access will automatically translate standard SQL data types of CHAR and
VARCHAR into the Access Short Text (less than 256 characters) or Long Text data
type. It will also automatically translate (for strings less than and ) DATE columns
into the Access Date/Time type.
• The best way to learn SQL is to do it. Students should complete the review
questions and at least one of the Garden Glory, James River, or Queen Anne
Curiosity Shop project sets.
• Microsoft’s SQL Server Management Studio and MySQL’s MySQL Workbench are
great tools for teaching and learning SQL. Use of these tools is covered in Appendix
A for SQL Server 2016 and Appendix C for MySQL 5.7. Even if you’re using
Microsoft Access, you might set up a class demo using SQL Server Management
Studio or MySQL Workbench to show students how important SQL knowledge is.
The solutions to the Review Questions and the Projects show the correct code for
SQL Server 2016.
• Warning: There is no SQL standard for creating a surrogate key. The text
discusses how surrogate keys are handled in various products, but be sure to
emphasize this point to your students and to demonstrate how to use surrogate keys
in the DBMS you are using for your class assignments.
• Warning: SQL works with the standard quote character – ‘ – but does not recognize
the fancier beginning and ending quote characters found in most word processing
character sets. For example, the Times New Roman font produces the quote
characters ‘ and ’ that are curled and have different beginning and ending quotes
(look carefully at the characters in this paragraph). If you cut and paste text into an
SQL tool such as Microsoft SQL Server’s SQL Management Studio, your text will not
work with the fancy quotes, but you may still get error messages and have to edit the
text. The proper quote character is used in the solutions.
• Warning: Microsoft SQL requires square brackets [ and ] around table or column
names that are SQL reserved keywords.
• Use the appropriate text editor for the DBMS you are using. For creating SQL
commands for Microsoft Access, use Microsoft’s Notepad (or a similar text editor). If
you are working with Microsoft SQL Server 2016, use the editing capabilities of the
Query windows in Microsoft’s SQL Server Management Studio. If you are using
Oracle Database XE, use the SQL Developer query windows. Moreover, if you are
working with MySQL, use the editing features of the MySQL Workbench.