MySQL Forums
Forum List  »  Newbie

How to allow for 'unlimited' fields in an attribute.
Posted by: michael ponds
Date: September 06, 2014 11:10AM

Hi I have the following table;

CREATE TABLE `PIZZA` (`pizza_name` VARCHAR(45) NULL,
`pizza_price` DECIMAL(5,2) NULL,
`pizza_kj` INT NULL,
`pizza_slice_kj` INT NULL,
`pizza_ingred1` VARCHAR(45) NULL,
`pizza_ingred2` VARCHAR(45) NULL,
`pizza_ingred3` VARCHAR(45) NULL,
`pizza_ingred4` VARCHAR(45) NULL,
`pizza_ingred5` VARCHAR(45) NULL,
`pizza_ingred6` VARCHAR(45) NULL,
`pizza_ingred7` VARCHAR(45) NULL,
`pizza_ingred8` VARCHAR(45) NULL,
`pizza_ingred9` VARCHAR(45) NULL);

The data in this table, for example, is;

insert into `pizza` values('Super Supreme',8.5,6816,852,'beef','ham','pepperoni','italian sausage','onion','mushroom','pineapple','capsicum','olives');

or

insert into `pizza` values('Hawaiian',8.5,6022,753,'Ham','pineapple','mozzarella','tomato sauce','','','','','');

This table was given to us in a lab. I need to work out how to split this into two tables, pizza and pizza_ingredients and insert the data (this part i know how to do). But in the new pizza_ingredient table I also have to allow for more ingredients than 9. They do not say how many specifically, so I assume we need to make it unlimited. Is there a way to do this? Thank you for any help.

Options: ReplyQuote


Subject
Written By
Posted
How to allow for 'unlimited' fields in an attribute.
September 06, 2014 11:10AM


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.