Re: [SQL] Normalising an existing table - how?

2004-06-25 Thread Graham Leggett
Richard Huxton wrote: How would I put the primary key of each row in newtable back into oldtable? Also, newtable already exists and contains data - I need to add normalised data to an already partially normalised database. How can newtable contain data if you don't have any keys for it? Perhaps

Re: [SQL] Normalising an existing table - how?

2004-06-24 Thread Graham Leggett
Phil Endecott wrote: - Select the money column from the table - Populate the new normalised table with each row containing the value from the original money column - Write the primary keys of the new rows in the normalised table, back to a new column in the original table added for this purpose.

Re: [SQL] Normalising an existing table - how?

2004-06-24 Thread Graham Leggett
Frank Bax wrote: Do all three steps in one command: create table newtable as (select key1, key2, money from oldtable); How would I put the primary key of each row in newtable back into oldtable? Also, newtable already exists and contains data - I need to add normalised data to an already partiall

[SQL] Normalising an existing table - how?

2004-06-24 Thread Graham Leggett
Hi all, I have an existing table containing a column in it containing a money value. I would like to normalise this column into a separate table, as the money value is to be expanded to contain a tax value, etc. I have been trying to find a SQL query that will do the following: - Select the mone