short.fuse.5254 Posted August 5, 2014 Share Posted August 5, 2014 I'm having issues with Page 214 -Chapter 7-... This is how the book showed the example turning out: This is how mine turned out: This example on page 215 is not working right either: I don't understand where I went wrong & why the examples aren't turning out like the author's on these. I downloaded the sql commands that go with the book & ran this on the sql tab in PhpMyAdmin: CREATE DATABASE banking CHARACTER SET utf8 COLLATE utf8_general_ci; USE banking; CREATE TABLE customers ( customer_id INT UNSIGNED NOT NULL AUTO_INCREMENT, first_name VARCHAR(20) NOT NULL, last_name VARCHAR(40) NOT NULL, PRIMARY KEY (customer_id), INDEX full_name (last_name, first_name) ) ENGINE = INNODB; CREATE TABLE accounts ( account_id INT UNSIGNED NOT NULL AUTO_INCREMENT, customer_id INT UNSIGNED NOT NULL, type ENUM('Checking', 'Savings') NOT NULL, balance DECIMAL(10,2) UNSIGNED NOT NULL DEFAULT 0.0, PRIMARY KEY (account_id), INDEX (customer_id), FOREIGN KEY (customer_id) REFERENCES customers (customer_id) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = INNODB; CREATE TABLE transactions ( transaction_id INT UNSIGNED NOT NULL AUTO_INCREMENT, to_account_id INT UNSIGNED NOT NULL, from_account_id INT UNSIGNED NOT NULL, amount DECIMAL(5,2) UNSIGNED NOT NULL, date_entered TIMESTAMP NOT NULL, PRIMARY KEY (transaction_id), INDEX (to_account_id), INDEX (from_account_id), INDEX (date_entered), FOREIGN KEY (to_account_id) REFERENCES accounts (account_id) ON DELETE NO ACTION ON UPDATE NO ACTION, FOREIGN KEY (from_account_id) REFERENCES accounts (account_id) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = INNODB; INSERT INTO customers (first_name, last_name) VALUES ('Sarah', 'Vowell'), ('David', 'Sedaris'), ('Kojo', 'Nnamdi'); INSERT INTO accounts (customer_id, balance) VALUES (1, 5460.23), (2, 909325.24), (3, 892.00); INSERT INTO accounts (customer_id, type, balance) VALUES (2, 'Savings', 13546.97); Link to comment Share on other sites More sharing options...
Larry Posted August 5, 2014 Share Posted August 5, 2014 It's undoubtedly just a matter of there being different data. Perhaps I had other records in there when I ran the query? It's really not a big deal, as your queries are working. Sorry for the confusion! Link to comment Share on other sites More sharing options...
short.fuse.5254 Posted August 5, 2014 Author Share Posted August 5, 2014 Oh, ok. Thank you Mr. Larry. Link to comment Share on other sites More sharing options...
Recommended Posts