To create a new table, use the SQL create command, with a list of the column names and attributes in the new data set. Here we create file test, with columns for name and salary.

First, drop test in case it already exists (the _1 result means the table was not found):

   'drop table test' ddsql__db ch
_1

Now create the new file:

   'create table test (name char(12),sal numeric)' ddsql__db ch
0

Add a record:

   t=. 'insert into test (name,sal) values (''Neumann,E'',40000)' 
   t ddsql__db ch
0

Add another record:

   t=. 'insert into test (name,sal) values (''James, P'',42000)' 
   t ddsql__db ch
0

Now read the file:

   ddfet__db _1,~ 'select * from test' ddsel__db ch
+---------+-----+
|Neumann,E|40000|
+---------+-----+
|James, P |42000|
+---------+-----+

JDD/Methods/Create (last edited 2011-05-07 08:12:43 by BillLam)