如果我有ERD:https://i.stack..com/gj3Sn.png
我正试图在postgres SQL中键入。这是怎么做到的?
到目前为止,我有:
CREATE TABLE ...
语句中有一些拼写错误。
它们的工作方式有一些变化。见下文:
CREATE TABLE TradingRoute (
OperatingCompany integer,
MonitoringKey text,
LastYearRevenue integer,
Taxes integer ,
Fleet_size integer,
PRIMARY KEY (MonitoringKey)
);
CREATE TABLE Planet (
Population integer,
Name text ,
PlanetID integer ,
StarSystem integer,
PRIMARY KEY (PlanetID)
);
CREATE TABLE SpaceStation (
OperatingCompany integer,
StationID integer ,
Longitude integer ,
Name text ,
Latitude integer,
PRIMARY KEY (StationID)
);
CREATE TABLE Product (
VolumePerTon integer,
Name text ,
ValuePerTon integer,
ProductID text ,
PRIMARY KEY (ProductID)
);
CREATE TABLE RawMaterial (
FundamentalOrComposite integer,
State Date
);
CREATE TABLE Batch (
BatchID integer,
ExtractionOrManufacturingDate Date ,
PRIMARY KEY (BatchID)
);
看到他们在DB Fiddle跑步。