Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
spot the problem.....

Posted by Chris_Isaac (Chris Isaac), 28 August 2007
Hi

I'm trying to brush up on my mysql, The following is code I'm trying to follow, taken out of a book, but it fails when trying to create the 2nd table, I've gone through it but can't see whats wrong.  BTW I'm using mysql v 5.0.22 if this makes a difference.

I've cut out most of it but left the 1st table to fail (artists_events).

Code:
# phpMyAdmin MySQL-Dump
# version 2.2.6
# http://phpwizard.net/phpMyAdmin/
# http://www.phpmyadmin.net/ (download page)
#
# Host: localhost
# Generation Time: Aug 28, 2002 at 11:19 AM
# Server version: 3.23.51
# PHP Version: 4.0.4
# Database : `tunein`
# --------------------------------------------------------

#
# Table structure for table `artists`
#

DROP TABLE IF EXISTS `artists`;
CREATE TABLE `artists` (
 `artist_id` int(4) NOT NULL auto_increment,
 `artist_name` varchar(100) NOT NULL default '',
 PRIMARY KEY  (`artist_id`),
 UNIQUE KEY `artist_name` (`artist_name`)
) TYPE=InnoDB COMMENT='Musical performer or group.';
# --------------------------------------------------------

#
# Table structure for table `artists_events`
#

DROP TABLE IF EXISTS `artists_events`;
CREATE TABLE `artists_events` (
 `artist_event_id` int(4) NOT NULL auto_increment,
 `artist_id` int(4) NOT NULL default '0',
 `event_id` int(4) NOT NULL default '0',
 PRIMARY KEY  (`artist_event_id`),
 KEY `artist_id` (`artist_id`),
 KEY `event_id` (`event_id`),
 FOREIGN KEY (`artist_id`) REFERENCES `tunein.artists` (`artist_id`),
 FOREIGN KEY (`event_id`) REFERENCES `tunein.events` (`event_id`)
) TYPE=InnoDB COMMENT='Lookup table for artists and events where they perform.';
# --------------------------------------------------------





Posted by Chris_Isaac (Chris Isaac), 29 August 2007
Ok, kinda sorted the problem out, even got the data in to the tables

Question though, When using Foreign Keys and References, why does the data need to be put into the tables in a particular order?

Hope the question makes sense, not too sure if I'm asking the right one  

Posted by admin (Graham Ellis), 30 August 2007
Not sure either, Chris ... my mind's not in SQL mode at the moment - sorry.  Come back and nag me in a couple of days if you need a further bit of help to move practically forward or an answer on the side issue raised.

Weren't you supposed to be coming to see us some time?   Next couple of weejends are frannkly busied out but it then starts getting much more do-able from Mid September!

Posted by Chris_Isaac (Chris Isaac), 30 August 2007
Thanks Graham, Yes believe me we still want to come down and catch up, perhaps a curry as well

Will bounce some dates off the boss wife and see when we can make it.

Look forward to seeing you soon.

Cheers

Chris



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho