theGrayFox
theGrayFox

Reputation: 931

Converting from Oracle to Mysql

I'm having trouble converting this to MySql. I originally had this in an Oracle Database, but I'm getting an error on line 6. How can I fix this?

create table racewinners (
    racename varchar(20) not null,
    raceyear integer,
    ridername varchar(20) not null,
    distance integer,
    winning_time INTERVAL DAY (9) TO SECOND (2), 
    constraint racewinners_rname_ryear_pk primary key (racename, raceyear),
    constraint racewinners_raceriders_fk foreign key (ridername) references raceriders(ridername)
);

Upvotes: 0

Views: 44

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269473

MySQL doesn't have an interval data type. You should be able to use datetime for this. The following is a typical way to write this for MySQL:

create table racewinners (
    racename varchar(20) not null,
    raceyear integer,
    ridername varchar(20) not null,
    distance int,
    winning_time datetime, 
    primary key (racename, raceyear),
    foreign key (ridername) references raceriders(ridername)
);

Upvotes: 3

Related Questions