Previous Next JavaScript must be enabled to correctly display this content

## 5.4.7 Managing Quick SQL Models and Scripts

Save entered Quick SQL shorthand syntax as a model for future use, or save the generated SQL as a SQL script.

- Saving a Quick SQL Model
  Reuse Quick SQL shorthand syntax by saving a model.
- Loading a Saved Quick SQL Model
  Load saved Quick SQL models from the Load window.
- Saving a Quick SQL Model Under a Different Name
  Save a Quick SQL model under a different name.
- Deleting a Quick SQL Model
  Delete an existing Quick SQL model with the Save Model dialog.
- Viewing an Entity Relationship Diagram
  View an entity relationship diagram of a data model's tables, columns, datatypes, and relationships.
- Saving a Generated SQL Script
  Save generated SQL as a script in SQL Scripts.
- Downloading SQL Scripts
  Download a generated SQL script locally.

Parent topic: Using Quick SQL

### 5.4.7.1 Saving a Quick SQL Model

Reuse Quick SQL shorthand syntax by saving a model.

To save a Quick SQL model:

1. On the Quick SQL page, click the Quick SQL Actions menu (three vertical dots) and select Save Model for an unsaved model or Update Model for a pre-existing model.
   The Save Model dialog appears.
2. In the Save Model dialog:
   1. Model Name - Enter a name.
   2. Description - Enter a description for the model.
   3. Click Save Model or Update Model.
   The `Model saved` message appears.

Parent topic: Managing Quick SQL Models and Scripts

### 5.4.7.2 Loading a Saved Quick SQL Model

Load saved Quick SQL models from the Load window.

Developers can view and load their own saved models on the Load window under My Models or all workspace developer models under Workspace Models.

To load a saved Quick SQL model:

1. On the Quick SQL page, click the Quick SQL Actions menu (three vertical dots) and select Load .

   The Load windows appears and displays three tabs:

   - Samples
   - My Models
   - Workspace Models
2. To load a saved model:
   1. Under either My Models or Workspace Models, choose a model.
   2. Click Load Model.
   The selected model appears.
3. To edit the model name or description, or delete a saved model:
   1. View the Load window.

      On the Quick SQL page, click the Quick SQL Actions menu (three vertical dots) and select the Load action.

   2. Under either My Models or Workspace Models, choose a model.
   3. Click the model name.
      The Edit Model dialog appears.
   4. Edit the model name or description and click Save.
   5. To delete the model, click Delete.

Parent topic: Managing Quick SQL Models and Scripts

### 5.4.7.3 Saving a Quick SQL Model Under a Different Name

Save a Quick SQL model under a different name.

To save a Quick SQL model under a different name:

1. On the Quick SQL page, click the Quick SQL Actions menu (three vertical dots) and select Save Model As.
   The Save Model dialog appears.
2. In the Save Model dialog:
   1. Model Name - Enter a new model name.
   2. Description - (Optional) Enter a description for the model.
   3. Click Save Model.
   The `Model saved` message appears.

Parent topic: Managing Quick SQL Models and Scripts

### 5.4.7.4 Deleting a Quick SQL Model

Delete an existing Quick SQL model with the Save Model dialog.

To delete a model:

1. On the Quick SQL page, click the Quick SQL Actions menu (three vertical dots) and click Update Model.
   The Save Model dialog appears.
2. Click Delete.
3. Click Delete again in the confirmation dialog.
   The model is deleted.

Parent topic: Managing Quick SQL Models and Scripts

### 5.4.7.5 Viewing an Entity Relationship Diagram

View an entity relationship diagram of a data model's tables, columns, datatypes, and relationships.

To view entity relationship diagram of a data model's tables, columns, datatypes, and relationships:

1. On the Quick SQL page, load a Quick SQL model.
2. On the right pane, click the Diagram tab.

   The entity relationship diagram appears.

   Description of the illustration quick_sql_diagram.png

Parent topic: Managing Quick SQL Models and Scripts

### 5.4.7.6 Saving a Generated SQL Script

Save generated SQL as a script in SQL Scripts.

To save generated SQL as a script:

1. On the Quick SQL page, enter Quick SQL shorthand syntax in the left pane.

   The generated SQL displays in the right pane.

2. In the right pane, click the SQL Actions menu (three vertical dots) and select Save SQL Script .
3. In the Save Script dialog:
   1. Script Name - Enter a name.
   2. Click Save Script.

      - Script Name - Enter a name.

      - Click Save Script.

   The script is saved in SQL Scripts.

See Also:

- Generating SQL with SQL Shorthand Syntax
- Using SQL Scripts

Parent topic: Managing Quick SQL Models and Scripts

### 5.4.7.7 Downloading SQL Scripts

Download a generated SQL script locally.

To download a generated SQL script:

1. On the Quick SQL page, enter Quick SQL shorthand syntax in the left pane.

   The generated SQL displays in the right pane.

2. Scroll through generated SQL in right pane.

   At the bottom, the line starting with `-- Generated by Quick SQL` is the SQL shorthand syntax. If you specified any settings they display after the line starting with `# settings =` . Consider the following example:

       -- Generated by Quick SQL undefined 12/7/2023, 12:20:47 PM

       /*
       departments /insert 4
          name /nn
          location
          country
          employees /insert 14
             name /nn vc50
             email /lower
             cost center num
             date hired
             job vc255

       view emp_v departments employees

       --- Non-default options:
       # settings = {"apex":"Y","db":"19c"}

       */

3. In the right pane, click the SQL Actions menu (three vertical dots) and select Download .

Parent topic: Managing Quick SQL Models and Scripts