0
 NSString *sql2=[NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS %@ (officenoId INTEGER,companyname VARCHAR(20),cellnoId INTEGER,firstname varchar(30),lastname varchar(30));",customertable];

error is table has two columns but four values are supplied please tell me the way how to add column in existing table.

Vishnuvardhan
  • 5,081
  • 1
  • 17
  • 33
ashok
  • 1

2 Answers2

0
ALTER TABLE tablename ADD COLUMN columnname 

https://www.sqlite.org/lang_altertable.html

Ni Nö
  • 51
  • 7
0

If you want to modify a created table, you should take a look here:

https://www.sqlite.org/lang_altertable.html

Or here:

https://stackoverflow.com/a/4253879/4779986

ALTER TABLE tableName ADD COLUMN columnName type;

If you want to create a table only if It doesn't exist:

CREATE TABLE IF NOT EXISTS TABLENAME(
   ID INT PRIMARY KEY NOT NULL,
   COLUMN1 TEXT NOT NULL,
   COLUMN2 INT NOT NULL,
   COLUMN3 CHAR(50),
   COLUMN4 REAL
);
Community
  • 1
  • 1
Bisca
  • 6,380
  • 2
  • 19
  • 32