Recommended Readings

Answers to Self Review Exercises


a) SQL. b) rows, columns. c) ResultSet. d) primary key. e) WHERE. f) ORDER BY. g) joining. h) database. i) foreign key. j) DriverManager. k) Connection. l) Statement. m) JdbcRowSet, CachedRowSet n) CachedRowSet.



Using the techniques shown in this chapter, define a complete query application for the books database. Provide the following predefined queries:

  1. Select all authors from the authors table.
  2. Select all publishers from the publishers table.
  3. Select a specific author and list all books for that author. Include the title, year and ISBN. Order the information alphabetically by the author's last name and first name.
  4. Select a specific publisher and list all books published by that publisher. Include the title, year and ISBN. Order the information alphabetically by title.
  5. Provide any other queries you feel are appropriate.

Display a JComboBox with appropriate names for each predefined query. Also allow users to supply their own queries.


Define a complete data manipulation application for the books database. The user should be able to edit existing data and add new data to the database (obeying referential and entity integrity constraints). Allow the user to edit the database in the following ways:

  1. Add a new author.
  2. Edit the existing information for an author.
  3. Add a new title for an author. (Remember that the book must have an entry in the authorISBN table.) Be sure to specify the publisher of the title.
  4. Add a new publisher.
  5. Edit the existing information for a publisher.
  6. Add a new entry in the authorISBN table to link authors with titles.

In Section 10.7, we introduced an employee-payroll hierarchy to calculate each employee's payroll. In this exercise, we provide a database of employees that corresponds to the employee payroll hierarchy. (A SQL script to create the employees database is provided with the examples for this chapter on the CD that accompanies this text and on our Web site, Write an application that allows the user to:

  1. Add employees to the Employee table.
  2. Add payroll information to the appropriate table for each new employee. For example, for a salaried employee add the payroll information to the salariedEmployees table.

Figure 25.33 is the entity-relationship diagram for the employees database.

Figure 25.33. Table relationships in employees.


Modify Exercise 25.4 to provide a JComboBox and a JTextArea to allow the user to perform a query that is either selected from the JComboBox or defined in the JTextArea. Sample predefined queries are:

  1. Select all employees working in Department SALES.
  2. Select hourly employees working over 30 hours.
  3. Select all commission employees in descending order of the commission rate.

Modify Exercise 25.5 to perform the following tasks:

  1. Increase base salary by 10% for all base plus commission employees.
  2. If the employee's birthday is in the current month, add a $100 bonus.
  3. For all commission employees with gross sales over $10,000, add a $100 bonus.

Introduction to Computers, the Internet and the World Wide Web

Introduction to Java Applications

Introduction to Classes and Objects

Control Statements: Part I

Control Statements: Part 2

Methods: A Deeper Look


Classes and Objects: A Deeper Look

Object-Oriented Programming: Inheritance

Object-Oriented Programming: Polymorphism

GUI Components: Part 1

Graphics and Java 2D™

Exception Handling

Files and Streams


Searching and Sorting

Data Structures



Introduction to Java Applets

Multimedia: Applets and Applications

GUI Components: Part 2



Accessing Databases with JDBC


JavaServer Pages (JSP)

Formatted Output

Strings, Characters and Regular Expressions

Appendix A. Operator Precedence Chart

Appendix B. ASCII Character Set

Appendix C. Keywords and Reserved Words

Appendix D. Primitive Types

Appendix E. (On CD) Number Systems

Appendix F. (On CD) Unicode®

Appendix G. Using the Java API Documentation

Appendix H. (On CD) Creating Documentation with javadoc

Appendix I. (On CD) Bit Manipulation

Appendix J. (On CD) ATM Case Study Code

Appendix K. (On CD) Labeled break and continue Statements

Appendix L. (On CD) UML 2: Additional Diagram Types

Appendix M. (On CD) Design Patterns

Appendix N. Using the Debugger

Inside Back Cover

Java(c) How to Program
Java How to Program (6th Edition) (How to Program (Deitel))
ISBN: 0131483986
EAN: 2147483647
Year: 2003
Pages: 615 © 2008-2020.
If you may any questions please contact us: