www.gusucode.com > database 案例源码程序 matlab代码 > database/CreateTableMATLABInterfaceToSQLiteExample.m

    %% Create a Table Using the MATLAB(R) Interface to SQLite
% Create a SQLite connection |conn| to a new SQLite database file
% |tutorial.db|. Specify the file name in the current working folder.
%%
dbfile = fullfile(pwd,'tutorial.db');

conn = sqlite(dbfile,'create');
%%
% Create the table |inventoryTable| using |exec|.
%%
createInventoryTable = ['create table inventoryTable ' ...
    '(productNumber NUMERIC, Quantity NUMERIC, ' ...
    'Price NUMERIC, inventoryDate VARCHAR)'];

exec(conn,createInventoryTable)
%%
% |inventoryTable| is an empty table in |tutorial.db|.
%%
% Close the SQLite connection.
%%
close(conn)