View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Relational Table or something else?

Thread began 10/18/2009 1:42 am by troyd | Last modified 10/22/2009 4:26 pm by troyd | 2518 views | 16 replies

Dave BuchholzBeta Tester

Troy,

the manage relational tables behaviour is probably the most difficult to get your head around so don't be discouraged.

Here are some simple tables that I use to test stuff like this and dynamic dropdowns that might help you try stuff out

DROP TABLE IF EXISTS `engine`;
CREATE TABLE `engine` (
`engineID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`engineSize` decimal(3,1) NOT NULL,
PRIMARY KEY (`engineID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `engine`
--

INSERT INTO `engine` VALUES(1, 1.1);
INSERT INTO `engine` VALUES(2, 1.3);
INSERT INTO `engine` VALUES(3, 1.6);
INSERT INTO `engine` VALUES(4, 1.8);
INSERT INTO `engine` VALUES(5, 2.0);
INSERT INTO `engine` VALUES(6, 2.5);

-- --------------------------------------------------------

--
-- Table structure for table `manufacturer`
--

DROP TABLE IF EXISTS `manufacturer`;
CREATE TABLE `manufacturer` (
`manID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`manDesc` varchar(20) NOT NULL,
`url` varchar(20) NOT NULL,
PRIMARY KEY (`manID`),
FULLTEXT KEY `manDesc` (`manDesc`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `manufacturer`
--

INSERT INTO `manufacturer` VALUES(1, 'Ford', 'ford');
INSERT INTO `manufacturer` VALUES(2, 'Toyota', 'toyota');
INSERT INTO `manufacturer` VALUES(3, 'Vauxhall', 'vauxhall');

-- --------------------------------------------------------

--
-- Table structure for table `models`
--

DROP TABLE IF EXISTS `models`;
CREATE TABLE `models` (
`modelID` int(11) unsigned NOT NULL AUTO_INCREMENT,
`manID` int(11) NOT NULL,
`modelDesc` varchar(20) NOT NULL,
`url` varchar(20) NOT NULL,
PRIMARY KEY (`modelID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;

--
-- Dumping data for table `models`
--

INSERT INTO `models` VALUES(1, 1, 'Mondeo', 'mondeo');
INSERT INTO `models` VALUES(2, 1, 'Focus', 'focus');
INSERT INTO `models` VALUES(3, 1, 'Fiesta', 'fiesta');
INSERT INTO `models` VALUES(4, 2, 'Avensis', 'avensis');
INSERT INTO `models` VALUES(5, 2, 'Auris', 'auris');
INSERT INTO `models` VALUES(6, 2, 'Yaris', 'yaris');
INSERT INTO `models` VALUES(7, 3, 'Vectra', 'vectra');
INSERT INTO `models` VALUES(8, 3, 'Astra', 'astra');
INSERT INTO `models` VALUES(9, 3, 'Corsa', 'corsa');

-- --------------------------------------------------------

--
-- Table structure for table `model_engine`
--

DROP TABLE IF EXISTS `model_engine`;
CREATE TABLE `model_engine` (
`modelID` int(11) NOT NULL,
`engineID` int(11) NOT NULL,
PRIMARY KEY (`modelID`,`engineID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `model_engine`
--

INSERT INTO `model_engine` VALUES(1, 4);
INSERT INTO `model_engine` VALUES(1, 5);
INSERT INTO `model_engine` VALUES(1, 6);
INSERT INTO `model_engine` VALUES(2, 2);
INSERT INTO `model_engine` VALUES(2, 3);
INSERT INTO `model_engine` VALUES(2, 4);
INSERT INTO `model_engine` VALUES(3, 1);
INSERT INTO `model_engine` VALUES(3, 2);
INSERT INTO `model_engine` VALUES(3, 3);
INSERT INTO `model_engine` VALUES(4, 3);
INSERT INTO `model_engine` VALUES(4, 4);
INSERT INTO `model_engine` VALUES(4, 5);
INSERT INTO `model_engine` VALUES(5, 2);
INSERT INTO `model_engine` VALUES(5, 3);
INSERT INTO `model_engine` VALUES(5, 4);
INSERT INTO `model_engine` VALUES(6, 1);
INSERT INTO `model_engine` VALUES(6, 2);
INSERT INTO `model_engine` VALUES(6, 3);
INSERT INTO `model_engine` VALUES(7, 4);
INSERT INTO `model_engine` VALUES(7, 5);
INSERT INTO `model_engine` VALUES(7, 6);
INSERT INTO `model_engine` VALUES(8, 3);
INSERT INTO `model_engine` VALUES(8, 4);
INSERT INTO `model_engine` VALUES(8, 5);
INSERT INTO `model_engine` VALUES(9, 1);
INSERT INTO `model_engine` VALUES(9, 2);
INSERT INTO `model_engine` VALUES(9, 3);




The model_engine table is the relational table and stores the model table ID and engine table ID so that multiple engines can be associated with a single model, does that make sense ?

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...