Database Reference
In-Depth Information
By The Way When using a date in the WHERE clause, you can usually enclose it in
single quotes just as you would a character string, However, when using
Microsoft Access you must enclose dates with the # symbol. For example:
SELECT *
FROM
PROJECT
WHERE
StartDate = #05/10/11#;
Oracles Database 11 g Release 2 and MySQL 5.6 can also have idiosyncrasies when
using date data in SQL statements, and this is discussed in Chapters 10B and 10C
respectively.
Submitting SQL Statements to the DBMS
Before continuing the explanation of SQL, it will be useful for you to learn how to submit SQL
statements to specific DBMS products. That way, you can work along with the text by keying
and running SQL statements as you read the discussion. The particular means by which you
submit SQL statements depends on the DBMS. Here we will describe the process for Microsoft
Access 2013, Microsoft SQL Server 2012, Oracle Database 11 g Release 2, and MySQL 5.6.
By The Way You can learn SQL without running the queries in a DBMS, so if for some
reason you do not have Microsoft Access, Microsoft SQL Server, Oracle
Database, or MySQL readily available, do not despair. You can learn SQL without them.
Chances are your instructor, like a lot of us in practice today, learned SQL without a
DBMS. It is just that SQL statements are easier to understand and remember if you can
run the SQL while you read. Given that there that there are freely downloadable versions
of Microsoft SQL Server 2012 Express edition, Oracle Database 11 g Express Edition,
and MySQL 5.6 Community Server, you can have an installed DBMS to run these SQL
examples even if you have not purchased Microsoft Access. See Chapters 10A, 10B,
and 10C for specific instructions for creating databases using each of these products.
The SQL scripts needed to create the Cape Codd Outdoor Sports database used in this
chapter are available at www.pearsonhighered.com/kroenke .
Using SQL in Microsoft access 2013
Before you can execute SQL statements, you need a computer that has Microsoft Access in-
stalled, and you need a Microsoft Access database that contains the tables and sample data in
Figure 2-5. Microsoft Access is part of many versions of the Microsoft Office suite, so it should
not be too difficult to find a computer that has it.
Because Microsoft Access is commonly used in classes that use this topic as a textbook,
we will look at how to use SQL in Microsoft Access in some detail. Before we proceed, however,
we need to discuss a specific peculiarity of Microsoft Access—the limitations of the default
version of SQL used in Microsoft Access.
“Does Not Work with Microsoft access aNSI-89 SQL”
As mentioned previously, our discussion of SQL is based on SQL features present in SQL
standards since the ANSI SQL-92 standard (which Microsoft refers to as ANSI-92 SQL).
Unfortunately, Microsoft Access 2013 still defaults to the earlier SQL-89 version—Microsoft
calls it ANSI-89 SQL or Microsoft Jet SQL (after the Microsoft Jet DBMS engine used by
Microsoft Access). ANSI-89 SQL differs significantly from SQL-92, and, therefore, some fea-
tures of the SQL-92 language will not work in Microsoft Access.
Microsoft Access 2013 (and the earlier Microsoft Access 2003, 2007, and 2010 versions) does
contain a setting that allows you to use SQL-92 instead of the default ANSI-89 SQL. Microsoft
included this option to allow Microsoft Access tools such as forms and reports to be used in
 
 
Search WWH ::




Custom Search