20.07.2013 Views

Beginning SQL

Beginning SQL

Beginning SQL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix C<br />

Category Table<br />

The following <strong>SQL</strong> inserts data into the Category table, and it runs on all 5 of the database systems:<br />

INSERT INTO Category (CategoryId, Category) VALUES (1, ‘Thriller’);<br />

INSERT INTO Category (CategoryId, Category) VALUES (2, ‘Romance’);<br />

INSERT INTO Category (CategoryId, Category) VALUES (3, ‘Horror’);<br />

INSERT INTO Category (CategoryId, Category) VALUES (4, ‘War’);<br />

INSERT INTO Category (CategoryId, Category) VALUES (5, ‘Sci-fi’);<br />

INSERT INTO Category (CategoryId, Category) VALUES (6, ‘Historical’);<br />

You can find this text in the file CategoryTable_Data.txt.<br />

MemberDetails Table<br />

The default installation of Oracle usually requires dates in the following format:<br />

day_of_the_month month_name year<br />

For example, you would type January 23, 2004, as 23 Jan 2004.<br />

The other four database systems are happy with the following format:<br />

year-month-day_of_the_month<br />

You would type January 23, 2004, as 2004-01-23.<br />

Since there are two different date formats, this section is divided into two subsections: non-Oracle<br />

databases and Oracle databases.<br />

Database Systems Other Than Oracle<br />

452<br />

If you’ve downloaded the code, the file named MemberDetailsTable_Data.txt contains the information<br />

that populates the MemberDetails table in <strong>SQL</strong> Server, MS Access, My<strong>SQL</strong>, and IBM DB2.<br />

INSERT INTO MemberDetails<br />

(<br />

MemberId,<br />

FirstName,<br />

LastName,<br />

DateOfBirth,<br />

Street,<br />

City,<br />

State,<br />

ZipCode,<br />

Email,<br />

DateOfJoining<br />

)<br />

VALUES

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

Saved successfully!

Ooh no, something went wrong!