25.2 |
Using the techniques shown in this chapter, define a complete query application for the books database. Provide the following predefined queries:
- Select all authors from the authors table.
- Select all publishers from the publishers table.
- 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.
- Select a specific publisher and list all books published by that publisher. Include the title, year and ISBN. Order the information alphabetically by title.
- 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.
|
25.3 |
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:
- Add a new author.
- Edit the existing information for an author.
- 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.
- Add a new publisher.
- Edit the existing information for a publisher.
- Add a new entry in the authorISBN table to link authors with titles.
|
|
|
25.4 |
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, www.deitel.com.) Write an application that allows the user to:
- Add employees to the Employee table.
- 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.
|
25.5 |
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:
- Select all employees working in Department SALES.
- Select hourly employees working over 30 hours.
- Select all commission employees in descending order of the commission rate.
|
25.6 |
Modify Exercise 25.5 to perform the following tasks:
- Increase base salary by 10% for all base plus commission employees.
- If the employee's birthday is in the current month, add a $100 bonus.
- For all commission employees with gross sales over $10,000, add a $100 bonus.
|