On 13 Jun 10:39, Richard Parsons wrote:
Chris Walker cdw_alug@the-walker-household.co.uk wrote:
On 13/06/11 10:20, Richard Parsons wrote:
Chris Walkercdw_alug@the-walker-household.co.uk wrote:
Can you elaborate on "I want the tables to be created from the names in column 3"?
This isn't my data but imagine a list of pub names in Name1, a score in Number, Brewery Name in Name2, Yes/No in Y/N, a simple address in Where and random text in Notes.
So you want multiple tables, with each tables name being the Brewery Name?
Why not have one big table, with the Brewery Name as a column?
I already have a big table of Brewery Names. I then want to be able to click on the Brewery Name and have SQL display a list of their beers.
Here I want to extract a list of the beers (plus other data) from the OO spreadsheet.
Maybe, you need to re-think your proposed database structure. I'm no expert, but when you add data (like another Brewery Name) to a database you shouldn't need to add a new table. Have a look at this article which I think may help: http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html
So, what I'd be looking at is:
Table : Brewery Columns: id name description
Table : Beer Columns: id brewery_id name description
Thus having a one to many relationship between brewery and beer, storing the id of the brewery in the beer means that you can change the fields of the brewery (in the event of it being renamed, or the description changing, etc), and that applies immediately to all beers of the brewery.
This is normal database normalisation.
Cheers,