PDA

View Full Version : [MYSQL] convertire una query postgresql a mysql


MrEnrich
22-06-2011, 19:13
come faccio a eseguire queste query fatte con pgsql a mysql ?

create database pneumatici;

CREATE TABLE negozio_dt
(
id serial NOT NULL,
regione varchar(255) NOT NULL,
codistat_regione varchar(3) NOT NULL,
provincia varchar(255) NOT NULL,
codistat_provincia varchar(3) NOT NULL,
comune varchar(255),
codistat_comune varchar(255),
indirizzo varchar(255),
CONSTRAINT "negozio_pk" PRIMARY KEY (id)
);


CREATE TABLE periodo_dt
(
id serial NOT NULL,
anno int4 NOT NULL,
mese int4 NOT NULL,
CONSTRAINT time_pk PRIMARY KEY (id)
);


CREATE TABLE vendite_ft
(
id serial NOT NULL,
negozio_id int8 NOT NULL,
periodo_id int8,
n_normali int8,
n_bagnato int8,
n_neve int8,
n_sterrato int8,
profitto_normali int8,
profitto_bagnato int8,
profitto_neve int8,
profitto_sterrato int8,
CONSTRAINT vendite_pk PRIMARY KEY (id),
CONSTRAINT negozio_fk FOREIGN KEY (negozio_id)
REFERENCES negozio_dt (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED,
CONSTRAINT periodo_fk FOREIGN KEY (periodo_id)
REFERENCES periodo_dt (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED
);