SQL Queries for Mere Mortals

Main Sample Files Read Me

This folder contains the "master" copies of all the sample databases.  You will 
find additional copies of the sample databases specific to each chapter in the 
subfolders under this one.  

GENERAL INSTALLATION INSTRUCTIONS:
----------------------------------
1) Create a new folder on your hard drive called SQLQFMM.  All the sample
command files assume this folder is on your C: drive, but you can create
this folder on any drive that has at least 640 megabytes of free space and
edit the SQL command files later.  You will need an additional 80-100 
megabytes of free space to install Microsoft SQL Server version 7 Trial 
Edition.

2) Copy all the files and folders you find in the root folder on this
sample CD to the new folder on your hard drive.  If you have only 200
megabytes of free space, you can skip copying the files you find in the
MSSQL7 subfolder.

3) MAKE SURE the copies of the files on your hard drive are not marked
read-only.  Select the file in Windows Explorer, then choose Properties
from the File menu.  Make sure the Read-only box is unchecked.  You can
select multiple files at a time and unset the Read-only attribute for
all of them.

4) NOTE: You must install Microsoft Internet Explorer 4.0 or later in 
order to be able to successfully install Microsoft SQL Server.  If you 
do not have Internet Explorer, you can download the latest version from:
         http://www.microsoft.com/windows/ie/
If you want to install the Trial Edition of Microsoft SQL Server 
version 7, navigate to the MSSQL7 subfolder and run Autorun.EXE.  If
you are running Microsoft Windows NT 4.0, choose the Install SQL Server
7.0 Prerequisites option first, then choose the Windows NT 4.0 option.
From the main option panel, choose Install SQL Server 7.0 Components.
Choose the Database Server - Desktop Edition option to install Microsoft
SQL Server version 7 Trial Edition.  Be sure to accept ALL DEFAULT options
on the panels that follow.


The folders and files are as follows:

FOLDERS:
--------

Chapter04  Sample files for Chapter 4 - Creating a Simple Query
Chapter05  Sample files for Chapter 5 - Getting More Than Simple Columns
Chapter06  Sample files for Chapter 6 - Filtering Your Data
Chapter08  Sample files for Chapter 8 - INNER JOINS
Chapter09  Sample files for Chapter 9 - OUTER JOINS
Chapter10  Sample files for Chapter 10 - UNIONS
Chapter11  Sample files for Chapter 11 - Subqueries
Chapter12  Sample files for Chapter 12 - Summarizing Data
Chapter13  Sample files for Chapter 13 - Grouping Data
Chapter14  Sample files for Chapter 14 - Filtering Grouped Data
MSSQL7     Setup files for Microsoft SQL Server version 7, trial edition


FILES:
------

AttachMainDB.SQL

If you have Microsoft SQL Server version 7 or later or have installed the trial 
edition of Microsoft SQL Server version 7 from this sample CD, you can use this 
file to attach the master samples to your server.  Open Query Analyzer and sign on 
to your database system (use Login Name "sa" and no password for the trial edition 
of SQL Server).  Load this file by clicking the Load SQL Script button or by 
choosing Open from the File menu.  Execute the commands by clicking the Execute 
Query button, by pressing F5, or by choosing Execute from the Query menu.  Executing 
this file attaches the files directly from this folder.  The commands assume that 
you have copied the files to C:\SQLQFMM.  If you have installed them in a different 
folder or have copied them to your SQL Server DATA folder, you will need to edit 
this file in Query Analyzer or with any text editing program (Notepad or Wordpad 
work fine) to change the file locations in the commands.



Bowling League Database
-----------------------

BowlingLeagueData.SQL

This file contains the INSERT commands to load the sample data to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used 
ANSI-Standard data types and syntax in all the commands.  You may need to edit 
this file to get it to work with your database system.  Consult your database
documentation for instructions about how to execute this command file.


BowlingLeagueExample.mdb

This is the Microsoft Access 2000 version of the Bowling League sample database.


BowlingLeagueExample.mdf

This is the Microsoft SQL Server version of the database.  See the notes on 
AttachMainDB.SQL above for instructions about how to attach this file to your 
server.


BowlingLeagueTables.SQL

This file contains the CREATE TABLE commands to define the tables to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used ANSI-
Standard data types and syntax in all the commands.  For example, the Microsoft 
SQL Server and Microsoft Access databases support a Money or Currency and 
DateTime data types, but we changed these to ANSI-Standard equivalents in these 
commands.  We also used ANSI-Standard REFERENCES clauses, which are not supported 
by some database systems, to define the relationships between the tables.  You 
may need to edit this file to get it to work with your database system.  After 
you define the tables, you can use BowlingLeagueData.SQL to load the sample data.  
You will find separate data load command files in each chapter subfolder.  If you 
want to run the examples specific to a chapter, first create your database tables 
using this file, and then load the data for the chapter from the file specific to 
the chapter.  Consult your database documentation for instructions about how to 
execute this command file.



Entertainment Agency Database
-----------------------------

EntertainmentAgencyData.SQL

This file contains the INSERT commands to load the sample data to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used 
ANSI-Standard data types and syntax in all the commands.  You may need to edit 
this file to get it to work with your database system.  Consult your database
documentation for instructions about how to execute this command file.


EntertainmentAgencyExample.mdb

This is the Microsoft Access 2000 version of the Entertainment Agency sample 
database.


EntertainmentAgencyExample.mdf

This is the Microsoft SQL Server version of the database.  See the notes on 
AttachMainDB.SQL above for instructions about how to attach this file to your 
server.


EntertainmentAgencyTables.SQL

This file contains the CREATE TABLE commands to define the tables to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used ANSI-
Standard data types and syntax in all the commands.  For example, the Microsoft 
SQL Server and Microsoft Access databases support a Money or Currency and 
DateTime data types, but we changed these to ANSI-Standard equivalents in these 
commands.  We also used ANSI-Standard REFERENCES clauses, which are not supported 
by some database systems, to define the relationships between the tables.  You 
may need to edit this file to get it to work with your database system.  After 
you define the tables, you can use EntertainmentAgencyData.SQL to load the sample 
data.  You will find separate data load command files in each chapter subfolder.  
If you want to run the examples specific to a chapter, first create your database 
tables using this file, and then load the data for the chapter from the file 
specific to the chapter.  Consult your database documentation for instructions 
about how to execute this command file.



Recipes Database
----------------

RecipesData.SQL

This file contains the INSERT commands to load the sample data to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used 
ANSI-Standard data types and syntax in all the commands.  You may need to edit 
this file to get it to work with your database system.  Consult your database
documentation for instructions about how to execute this command file.


RecipesExample.mdb

This is the Microsoft Access 2000 version of the Recipes sample database.


RecipesExample.mdf

This is the Microsoft SQL Server version of the database.  See the notes on 
AttachMainDB.SQL above for instructions about how to attach this file to your 
server.


RecipesTables.SQL

This file contains the CREATE TABLE commands to define the tables to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used ANSI-
Standard data types and syntax in all the commands.  For example, the Microsoft 
SQL Server and Microsoft Access databases support a Money or Currency and 
DateTime data types, but we changed these to ANSI-Standard equivalents in these 
commands.  We also used ANSI-Standard REFERENCES clauses, which are not supported 
by some database systems, to define the relationships between the tables.  You 
may need to edit this file to get it to work with your database system.  After 
you define the tables, you can use RecipesData.SQL to load the sample data.  
You will find separate data load command files in each chapter subfolder.  If you 
want to run the examples specific to a chapter, first create your database tables 
using this file, and then load the data for the chapter from the file specific to 
the chapter.  Consult your database documentation for instructions about how to 
execute this command file.



Sales Orders Database
---------------------

SalesOrdersData.SQL

This file contains the INSERT commands to load the sample data to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used 
ANSI-Standard data types and syntax in all the commands.  You may need to edit 
this file to get it to work with your database system.  Consult your database
documentation for instructions about how to execute this command file.


SalesOrdersExample.mdb

This is the Microsoft Access 2000 version of the Sales Orders sample database.


SalesOrdersExample.mdf

This is the Microsoft SQL Server version of the database.  See the notes on 
AttachMainDB.SQL above for instructions about how to attach this file to your 
server.


SalesOrdersTables.SQL

This file contains the CREATE TABLE commands to define the tables to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used ANSI-
Standard data types and syntax in all the commands.  For example, the Microsoft 
SQL Server and Microsoft Access databases support a Money or Currency and 
DateTime data types, but we changed these to ANSI-Standard equivalents in these 
commands.  We also used ANSI-Standard REFERENCES clauses, which are not supported 
by some database systems, to define the relationships between the tables.  You 
may need to edit this file to get it to work with your database system.  After 
you define the tables, you can use SalesOrdersData.SQL to load the sample data.  
You will find separate data load command files in each chapter subfolder.  If you 
want to run the examples specific to a chapter, first create your database tables 
using this file, and then load the data for the chapter from the file specific to 
the chapter.  Consult your database documentation for instructions about how to 
execute this command file.



School Scheduling Database
--------------------------

SchoolSchedulingData.SQL

This file contains the INSERT commands to load the sample data to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used 
ANSI-Standard data types and syntax in all the commands.  You may need to edit 
this file to get it to work with your database system.  Consult your database
documentation for instructions about how to execute this command file.


SchoolSchedulingExample.mdb

This is the Microsoft Access 2000 version of the School Scheduling sample 
database.


SchoolSchedulingExample.mdf

This is the Microsoft SQL Server version of the database.  See the notes on 
AttachMainDB.SQL above for instructions about how to attach this file to your 
server.


SchoolSchedulingTables.SQL

This file contains the CREATE TABLE commands to define the tables to a database 
system other than Microsoft SQL Server or Microsoft Access 2000.  We used ANSI-
Standard data types and syntax in all the commands.  For example, the Microsoft 
SQL Server and Microsoft Access databases support a Money or Currency and 
DateTime data types, but we changed these to ANSI-Standard equivalents in these 
commands.  We also used ANSI-Standard REFERENCES clauses, which are not supported 
by some database systems, to define the relationships between the tables.  You 
may need to edit this file to get it to work with your database system.  After 
you define the tables, you can use SchoolSchedulingData.SQL to load the sample data.  
You will find separate data load command files in each chapter subfolder.  If you 
want to run the examples specific to a chapter, first create your database tables 
using this file, and then load the data for the chapter from the file specific to 
the chapter.  Consult your database documentation for instructions about how to 
execute this command file.