简体   繁体   中英

PostgreSQL to MySQL syntax error

Hello there phpmyadmin returns an error of the following because it's postgreSQL and i need to migrate it to MySQL:

CREATE SEQUENCE ORDID
INCREMENT BY 1
START WITH 622
;

CREATE SEQUENCE PRODID
INCREMENT BY 1
START WITH 200381
;

CREATE SEQUENCE CUSTID
INCREMENT BY 1
START WITH 109
;

what is the equivalent syntax for the CREATE SEQUENCE?

In MySQL, a definition for such a table might look like this:

CREATE TABLE price
(prodid INT NOT NULL 
,stdprice DECIMAL(8,2) NOT NULL
,minprice DECIMAL(8,2) NOT NULL
,startdate DATE NOT NULL 
,enddate DATE
,PRIMARY KEY (prodid,startdate)
);

If you wanted a surrogate key, you could add price_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY to the above definition, and define the compound PRIMARY KEY as a UNIQUE KEY instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM