This Howto will show you how to create a SQL table with a SQL file that contains a CREATE SQL statement with the Tabul table create command.
You should have Tabulify installed on your computer: Learning Tabulify - Step 1 - Installation
We will execute the below SQL DDL Script that is located in the howto connection.
-- Create the foo table statement
create table foo (
bar integer
)
With the tabul data create command, if you use a runtime selector as first argument, the selected script are executed.
To execute the previous SQL script, the below the command should be executed:
tabul data create '(create_foo.sql@howto)@sqlite'
# The quotes are only mandatory in bash because parenthesis are a bash token (ie subshell)
where:
List of runtime executed
runtime_data_uri exit_code count latency data_uri error_message
----------------------------- --------- ----- ------- ------------------------------------------------------------- -------------
(create_foo.sql@howto)@sqlite 0 1 0.31s execute/20251110-204850-409-pipe-anonymous/create_foo.log@tmp
Check the metadata with the tabul data meta command
tabul data describe foo@sqlite
Structure of the resource foo@sqlite
position name type precision scale primary_key nullable autoincrement comment
-------- ---- ------- --------- ----- ----------- -------- ------------- -------
1 bar integer 0 0 x
You can also create a table and its dependencies (foreign tables) at once with the tabul data create command.