You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
386 B
15 lines
386 B
6 months ago
|
DROP TABLE IF EXISTS currency;
|
||
|
|
||
|
CREATE TABLE currency (id INTEGER PRIMARY KEY
|
||
|
AUTOINCREMENT NOT NULL, currency TEXT);
|
||
|
|
||
|
ALTER TABLE rate ADD COLUMN currency_id INTEGER;
|
||
|
|
||
|
INSERT INTO currency (currency) SELECT currency FROM rate GROUP BY
|
||
|
currency;
|
||
|
|
||
|
UPDATE rate SET currency_id = currency.id FROM currency WHERE
|
||
|
rate.currency = currency.currency;
|
||
|
|
||
|
ALTER TABLE rate DROP COLUMN currency;
|