0

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)
);

1 Answer 1

3

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)
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.