How to create a table with a CREATE Sql statement file

About

This Howto will show you how to create a SQL table with a SQL file that contains a CREATE SQL statement with the Tabli table create command.

Steps

Prerequisites

You should have Tabulify installed on your computer: Learning Tabulify - Step 1 - Installation

The CREATE table statement

We will execute the below SQL Script that is located in the howto connection.

-- Create the foo table statement

create table foo (
  bar integer
)


The data create command

With the tabli data create command, if you use a script selector as first argument, the selected script are executed.

To execute the previous SQL script, the below the command should be executed:

tabli data create (create_foo.sql@howto)@sqlite

where:

The list of create script data resources executed:
uri                             
-----------------------------   
(create_foo.sql@howto)@sqlite

Check the metadata

Check the metadata with the tabli data meta command

tabli data struct foo@sqlite
Position   Column Name   Data Type   Primary Key   Not Null   Auto Increment   Description   
--------   -----------   ---------   -----------   --------   --------------   -----------   
1          bar           integer                   x          false

Next

You can also create a table and its dependencies (foreign tables) at once with the tabli data create command.

How to copy a star/snowflake schema ?

Task Runner