From J Wiki
Jump to: navigation, search
ODBC: Data Sources | Handles | 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 ch

Now create the new file:

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

Add a record:

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

Add another record:

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

Now read the file:

   ddfet _1,~ 'select * from test' ddsel ch
|Neumann, E  |40000|
|James, P    |42000|