20.07.2013 Views

Beginning SQL

Beginning SQL

Beginning SQL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C<br />

Initial Data Setup<br />

In Appendix B and Chapter 1, you created the Film Club database, this book’s example database.<br />

In this appendix, you insert some initial data into the Film Club example database. Before reading<br />

this appendix, you should have read and executed the code in Appendix B and Chapter 1 and the<br />

first part of Chapter 2, up to and including the section entitled “Inserting Data into the Case Study<br />

Database.”<br />

This appendix walks you through the data to be inserted table by table. Generally speaking, the<br />

<strong>SQL</strong> is the same for all five database systems supported by this book; instances when the <strong>SQL</strong> differs<br />

are noted in subsections containing the <strong>SQL</strong> for the database system that requires changed<br />

<strong>SQL</strong> code.<br />

If you want to save yourself a whole lot of typing, don’t forget that you can download this code<br />

from www.wrox.com. Under each table is a reference to the correct file. All files are contained in<br />

the directory AppendixC. Note that when you do a file open operation — either from a menu or a<br />

toolbar — the dialog box to select a file usually displays only files with .sql extensions. Because<br />

this book’s downloadable files are saved as text files (.txt), you need to make sure to change the<br />

dialog box so that it shows all file types. The downloadable files are saved as text files because you<br />

might be working with a database system (such as Microsoft Access) that doesn’t load .sql files,<br />

so you need to use a text editor instead.<br />

Most of the database systems allow you to load in a whole file and execute it all at once. MS<br />

Access, however, doesn’t allow you to load an entire file at once, so you need to cut and paste one<br />

<strong>SQL</strong> statement at a time into a new query — though you can just reuse and execute the same query<br />

and cut and paste over the text. If you’re using Oracle, then don’t load the file using the Open<br />

command under the File menu; instead, use the START command as in the following:<br />

START C:\temp\CategoryTable_Data.txt<br />

Note, however, that you need to modify the START command to reflect wherever you’ve stored the<br />

downloaded files on your hard drive.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!