create table query using sqlite

2 Ansichten (letzte 30 Tage)
nikhil nambiar
nikhil nambiar am 12 Aug. 2017
Kommentiert: nikhil nambiar am 13 Aug. 2017
Hi,
I need to know how can I create table in sqlite database using exec. I have created connection object
con=sqlite('dbname.db','create');
I tried exec to create table for above database
curs=exec(conn,create table Atable('sno int primary key,xyz long, adb long'));
matlab throws an error with:
curs=exec(conn,create table R&DE('sno int primary key,latitude long, longitude long'));
Error: Unexpected MATLAB expression.
Next I tried doing
curs=exec(con,['create table R&DE(sno int primary key,latitude long, longitude long)']);
Error using sqlite/exec
Too many output arguments.
A solution or advice to this will be valuable
Thank you!!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Aug. 2017
Notice that cur is not returned in the example of creating a table:
exec(con, 'create table R&DE(sno int primary key,latitude long, longitude long)' );
Note: you might need to quote that table name:
exec(con, 'create table "R&DE"(sno int primary key,latitude long, longitude long)' );
  2 Kommentare
nikhil nambiar
nikhil nambiar am 13 Aug. 2017
It doesnt work Matlab throws an error: to many output argument
nikhil nambiar
nikhil nambiar am 13 Aug. 2017
My apologies !! It does work. Thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by