View Full Version : how to create a table in sqlite3 ,which containing a colon of type array
Apr 2, 2012, 07:10 AM
create table contacts (id integer primary key autoincrement, name text, address text, phone text);
in above line of code i want to store an array of phone numbers on place of a single number means smething like :-
create table contacts (id integer primary key autoincrement, name text, address text, phone array);
so my queestion is how to create a colon which can save an array object in it????? which data type should i used?????
Apr 2, 2012, 08:05 AM
There is no array data type in SQL. Some people get around the problem by using a delimited VARCHAR data type, which in your case look something like:
"xxx-xxx-xxxx; yyy-yyyy-yyyy; zzz-zzz-zzzz;"
Your code would have to parse the varchar string to extract the multiple phone numbers.
However, having multiple values in a single column is against the fundamental tenet of relational model since an attribute in a relation can have only one value drawn from an appropriate type. In other words its bad database design.
A better design would be to move the phone numbers out of the name/address table and put them in a separate table linked to the name/address table. That way each name could have zero to n telephone numbers associated with it.
Apr 2, 2012, 11:55 PM
sir is it possible to save an nsdictionary object as an field entry in sqlite? which data type should i take to store nsdictionary or nsarray object???plz suggest me ???????
is it possible by blob data type or any other???
Apr 3, 2012, 09:15 PM
You can use the software of "Sqlite Developer".