Skip to content

Lookup table values #83

Description

@amiles-eit

Idea Summary

Add a Quick SQL shorthand syntax to explicitly create lookup tables with a predefined set of values. This would allow both the table structure and its fixed data to be defined in the same Quick SQL script, without needing separate SQL insert statements.

Use Case

When developing a new application schema in APEX, it’s common to define lookup tables for enumerations like statuses, categories, or priority levels.

Quick SQL currently supports /insert and /values to generate random sample data, but there’s no way to specify fixed, curated values inline.

This forces developers to split the workflow: define the lookup table in Quick SQL, then write separate manual INSERT statements.

In collaborative schema design sessions with subject matter experts, it would be faster and clearer if the agreed-upon lookup values could be visible directly in the Quick SQL script.

Possible Solution

Introduce a directive such as /fixed or /enum in Quick SQL that:

  1. Optionally marks the table as a lookup table.

  2. Generates INSERT statements for the exact values provided.

Example Syntax:

statuses /lookup
  status_name vc50
  /fixed Planned
  /fixed In Progress
  /fixed Complete
  /fixed On Hold

Generated SQL:

CREATE TABLE statuses (
  status_id NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
  status_name VARCHAR2(50) NOT NULL UNIQUE
);
INSERT INTO statuses (status_name) VALUES ('Planned');
INSERT INTO statuses (status_name) VALUES ('In Progress');
INSERT INTO statuses (status_name) VALUES ('Complete');
INSERT INTO statuses (status_name) VALUES ('On Hold');

Benefits:

  • Keeps schema definition and seed data in one place.
  • Improves collaboration with SMEs during schema workshops.
  • Speeds up prototyping and testing by providing realistic enumerations immediately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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