11 SQL Statements for Flat-File Drivers : Create and Drop Table Statements

Create and Drop Table Statements
The flat-file drivers support SQL statements to create and delete database files. The Create Table statement is used to create files and the Drop Table statement is used to delete files.
Create Table
The form of the Create Table statement is:
CREATE TABLE table_name (col_definition[,col_definition,...])
table_name can be a simple table name or a full path name. A table name is preferred for portability to other SQL data sources. If a table name is used, the file is created in the directory you specified as the database directory in the connection string. If you did not specify a database directory in the connection string, the file is created in the directory specified as the database directory in .odbc.ini. If you did not specify a database directory in either place, the file is created in the current working directory at connect time.
col_definition is the column name, followed by the data type, followed by an optional column constraint definition. Values for column names are database specific. The data type specifies a column’s data type.
The only column constraint definition currently supported by some flat-file drivers is "not NULL." Not all flat-file tables support "not NULL" columns. In the cases where "not NULL" is not supported, this restriction is ignored and the driver returns a warning if "not NULL" is specified for a column. The "not NULL" column constraint definition is allowed in the driver so that you can write a database-independent application (and not be concerned about the driver raising an error on a Create Table statement with a "not NULL" restriction).
A sample Create Table statement to create an employee database table is:
CREATE TABLE emp (last_name CHAR(20) NOT NULL,
  first_name CHAR(12) NOT NULL,
  salary NUMERIC (10,2) NOT NULL,
  hire_date DATE NOT NULL)
Drop Table
The form of the Drop Table statement is:
DROP TABLE table_name
table_name can be a simple table name (emp) or a full path name. A table name is preferred for portability to other SQL data sources. If a table name is used, the file is dropped from the directory you specified as the database directory in the connection string. If you did not specify a database directory in the connection string, the file is deleted from the directory specified as the database directory in .odbc.ini. If you did not specify a database directory in either of these places, the file is dropped from the current working directory at connect time.
A sample Drop Table statement to delete the emp table is:
DROP TABLE emp