Friday, May 29, 2009

Exercise 8: Answer

1. Start with a simple table in the database: In order to get this to happen I needed to create a database and then create a table 'employees'
DROP TABLE IF EXISTS `exercise8`.`employees`; CREATE TABLE `exercise8`.`employees` ( `first` varchar(45) NOT NULL, `last` varchar(45) NOT NULL, `address` varchar(45) NOT NULL, `position` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert a record
insert into exercise8.employees(first,last,address,position) values('First','Last','Address','Position');
run the query
SELECT * FROM exercise8.employees e;
and the result surprise, surprise is the first record from the employees table. 2. Create a Webpage
Here is a screenshot of the code and the webpage output

3. and 4. Add a record
Here is a screenshot of the webpage output and the code
5. Retrieve multiple records
Here is a screenshot of the webpage output and the code

No comments:

Post a Comment