SQLEditor Icon

Exporting to SQL

  1. Choose FileExport to File ...
  2. In the save panel that appears choose a file name (for example database.sql).
  3. Click Save

The file extension will normally be .sql

Tip:
SQLEditor associates itself with the .sql file extension, so you may need to open the saved file from within your text editor.

If you open the file using Text Edit (or your favourite text editor) you can then see the contents should look something like this:

    /* SQLEditor (Generic SQL)*/

    CREATE TABLE books
    (
    book_id INTEGER,
    title VARCHAR(255),
    author VARCHAR(255),
    PRIMARY KEY (book_id)
    );

    CREATE TABLE borrower
    (
    borrower_id INTEGER,
    surname VARCHAR(255),
    firstname VARCHAR(255),
    PRIMARY KEY (borrower_id)
    );

    CREATE TABLE loans
    (
    loan_id INTEGER,
    book_id INTEGER,
    borrower_id INTEGER,
    PRIMARY KEY (loan_id)
    );

    ALTER TABLE loans ADD FOREIGN KEY (book_id) REFERENCES books (book_id);

    ALTER TABLE loans ADD FOREIGN KEY (borrower_id) REFERENCES borrower (borrower_id);

← Previous Step
Return to Start →