Chapter 4 Lab
Adding Rows to Database Tables
Make yourself a copy of this
CGI script
.
Reads information about a book to be added to the
title
table of the Nile database from an
HTML form
Checks that the values entered into the form are reasonable.
Connects to the Nile database and INSERTs the new book into the table.
Tasks to Do for this Lab
Modify the CGI script to add the proper SQL for the INSERT statement.
Solution
Source code
A form to call it from
Extra for Experts
Reject attempts to INSERT a book that already exists in the table, i.e. when a book already exists with the same title, price, and edition.
Solution source code
A form to call it from
Extra-Extra for Expert-Experts
Modify the HTML form and CGI script to elicit the
title_id
from the user instead of by auto-incrementing. What happens when you try to INSERT a book with a duplicate
title_id
?
Solution source code
A form to call it from
Extra-Extra-Extra for Expert-Expert-Experts
So far, are we complying with relational database normal form? If not, how should we modify our schema?
A possible reorganization of the tables
[ ] [
Course Contents
] [
Home
] [
Curriculum
]
http://www.keller.com/dbweb/4/lab.html
Updated
Wednesday, 31-Oct-2001 14:17:45 CST
Copyright © 2006
Dan Keller Technical Services
4500 19th St., San Francisco
California, USA 94114
tel: 415 / 861-4500