From J Wiki
Jump to: navigation, search
JDD: Driver Locale | Handles | Data Sources | Data Driver | Error Messages | API: Connect Read Update Create Bulk Insert

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

Now create the new file:

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

Add a record:

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

Add another record:

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

Now read the file:

   ddfet__db _1,~ 'select * from test' ddsel__db ch
|James, P |42000|