Relational

JOINS

Implicit vs Explicit Joins

Currently, Datascale only supports explicit joins, as shown in the example below.

To workaround this, you can ask GPT to convert Implicit joins to explicit joins. Example prompt:

Please help me convert the following SQL query from implicit joins to explicit joins:

{{query}}


DDL

Simplify syntax

Some DDL syntax is currently not supported.

If you don't see the diagram output , please simplify settings in your schema (suggested to start including only column names and data types)

Example:

CREATE TABEL {{table_name}} (
   {{column_name}} TYPE
)

Supported references statements

  • FOREIGN KEY (id) REFERENCES table(id);
  • ADD CONSTRAINT ... FOREIGN KEY(id) REFERENCES table(id);
Example DDLs
CREATE TABLE another_table (
  id INT,
  description TEXT
);

-- Using REFERENCES
CREATE TABLE new_table (
  id INT UNIQUE PRIMARY KEY,
  another_id INT NOT NULL,
  FOREIGN KEY (another_id) REFERENCES another_table(id),
);


-- Or Adding CONSTRAINT
CREATE TABLE sports(
    sport_id INT,
    sport_name VARCHAR(255) NOT NULL,
    PRIMARY KEY(sport_id)
);

CREATE TABLE person(
    person_id INT,
    PRIMARY KEY(person_id),
);

ALTER TABLE person
    ADD CONSTRAINT fk_sport_id FOREIGN KEY(sport_id) REFERENCES sports(sport_id);

Last updated