Learning PHP and MySQL

Example 09-03 The SQL to recreate the test objects8

--
-- 
Table structure for table `authors`
--
DROP TABLE IF EXISTS `authors`; 
CREATE TABLE `authors` ( `author_idint(11NOT NULL auto_increment,
                         `
title_idint(11NOT NULL default '0',
                         `
authorvarchar(125) default NULL
                         
PRIMARY KEY  (`author_id`)
ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- 
Dumping data for table `authors`
--
INSERT INTO `authorsVALUES (1,1,'Ellen Siever'),(2,1,'Aaron Weber'),
                             (
3,2,'Arnold Robbins'),(4,2,'Nelson H.F. Beebe');
--
-- 
Table structure for table `books`
--
DROP TABLE IF EXISTS `books`; 
CREATE TABLE `books` ( `title_idint(11NOT NULL auto_increment,
                       `
titlevarchar(150) default NULL,
                       `
pagesint(11) default NULL
                       
PRIMARY KEY  (`title_id`)
ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- 
Dumping data for table `books`
--
INSERT INTO `booksVALUES (1,'Linux in a Nutshell',476), 
                           (
2,'Classic Shell Scripting',256);
--
-- 
Table structure for table `purchases`
--
DROP TABLE IF EXISTS `purchases`; 
CREATE TABLE `purchases` ( `idint(11NOT NULL auto_increment,
                           `
uservarchar(10) default NULL,
                           `
titlevarchar(150) default NULL,
                           `
daydate default NULL
                           
PRIMARY KEY  (`id`)
ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- 
Dumping data for table `purchases`
--
LOCK TABLES `purchasesWRITE;
INSERT INTO `purchasesVALUES (1,'Mdavis','Regular Expression Pocket Reference','2005-02-15'),
                               (
2,'Mdavis','JavaScript & DHTML Cookbook','2005-02-10');

Posted by on 08/07 at 05:22 PM

Next entry: Example 09-04 Including the connection values and calling mysql_connect

Previous entry: Example 09-01 PHP file format

<< Back to main