MySQL Forums
Forum List  »  Newbie

Is the book wrong?
Posted by: rick emmet
Date: May 04, 2005 12:59PM

Hello,
I'm using phpMyAdmin 2.6.1 and MySQL 4.1 and since I'm new to MySQL I'm creating a test database using SQL statements from the "MySQL Tutorial" book by Welling and Thomson. I typed out this SQL statement directly from the book into the SQL view as follows...

create table department
(
departmentID int not null auto_increment primary key,
name varchar (30)
) type=InnoDB;

-- Dumping data for table `department`
--

INSERT INTO `department` VALUES (1, 'Information Technology');
--
--

create table employee
(
employeeID int not null auto_increment primary key,
name varchar (80),
job varchar (30),
departmentID int not null references department (departmentID)
) type=InnoDB;

-- Dumping data for table `employee`
--

INSERT INTO `employee` VALUES (1, 'Rick Emmet', 'DataGod', 1);
--
--

create table employeeSkills
(
employeeID int not null references employee (employeeID),
skill varchar (15) not null,
primary key (employeeID, skill)
) type=InnoDB;

-- Dumping data for table `employeeSkills`
--

INSERT INTO `employeeSkills` VALUES (1, 'Developer');
--
--

create table client
(
clientID int not null auto_increment primary key,
name varchar (40),
address varchar (100),
contactPerson varchar (80),
contactNumber char (12)
) type=InnoDB;

-- Dumping data for table `client`
--

INSERT INTO `client` VALUES (1, 'Travelersfreeclassifieds', 'Po Box 1618', 'The Man', 6194730326);
--
--

create table assignment
(
clientID int not null references client (clientID),
employeeID int not null references employee (employeeID),
workdate date not null,
hours float,
primary key (clientID, employeeID, workdate)
) type=InnoDB;

-- Dumping data for table `assignment`
--

INSERT INTO `assignment` VALUES (1, 1, 2005-04-07, 6);

I did added INSERT INTO statements because I wanted to save a step. I tried to create the tables without inserting data as well - both ways MySQL simply ignores the relationships in the SQL statement. The database has the tables but no relationship, Can anyone tell me why? Any help would be much appreciated.
Thanks,
Ricke

Options: ReplyQuote


Subject
Written By
Posted
Is the book wrong?
May 04, 2005 12:59PM
May 04, 2005 01:22PM
May 08, 2005 12:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.