[Gambas-bugtracker] Bug #1648: Native way to get more data from a field in any database engine

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sat Sep 28 00:18:30 CEST 2019


http://gambaswiki.org/bugtracker/edit?object=BUG.1648&from=L21haW4-

Comment #3 by Martín BELMONTE:

Maybe that arent standar sql, but I found this example in [1] where foreighn keys definitions in postgres are very similar to the sqlite way.
[1] http://www.postgresqltutorial.com/postgresql-foreign-key/

MySQL:

CREATE TABLE Orders (
    OrderID int NOT NULL,
    OrderNumber int NOT NULL,
    PersonID int,
    PRIMARY KEY (OrderID),
    FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
);


SQLite:

CREATE TABLE `Orders` (
    OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
    OrderNumber INTEGER NOT NULL,
    PersonID INTEGER,
    FOREIGN KEY(`PersonID`) REFERENCES `Persons`(`PersonID`)
);


PostgreSQL:

CREATE TABLE Orders (
    OrderID int NOT NULL,
    OrderNumber INTEGER NOT NULL,
    PersonID INTEGER,
    PRIMARY KEY (OrderID),
    FOREIGN KEY (PersonID) REFERENCES Persons (PersonID)
);




More information about the Bugtracker mailing list