Skip to content

Complete JOIN statements by using a foreign key #975

@DmitrySandalov

Description

@DmitrySandalov

When creating a query the foreign key relations on the tables can be used to inform autocomplete of possible JOINs, eg

CREATE TABLE Persons (
    PersonID int,
    LastName varchar(255),
    FirstName varchar(255),
    Address varchar(255),
    City varchar(255),
    PRIMARY KEY (PersonID)
);
CREATE TABLE Orders (
    OrderID int NOT NULL,
    OrderNumber int NOT NULL,
    PersonID int,
    PRIMARY KEY (OrderID),
    FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
);
mysql> SELECT * FROM Persons p JOIN Orders o ON p.PersonID=o.PersonID;

in particular ON p.PersonID=o.PersonID can be inferred from the foreign key relations.

This can be a very good time-save, and help exploring data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions