Monday, 14 March 2011

how to create a table in sqlite3 ,which containing a colon of type array


create table contacts (id integer primary key autoincrement, name text, address text, phone text);


in above line of code want store array of phone numbers on place of single number means smething :-

create table contacts (id integer primary key autoincrement, name text, address text, phone array);


queestion how create colon can save array object in it????? data type should used?????
 

there no array data type in sql. people around problem using delimited varchar data type, in case like:

"xxx-xxx-xxxx; yyy-yyyy-yyyy; zzz-zzz-zzzz;"

code have parse varchar string extract multiple phone numbers.

however, having multiple values in single column against fundamental tenet of relational model since attribute in relation can have 1 value drawn appropriate type. in other words bad database design.

better design move phone numbers out of name/address table , put them in separate table linked name/address table. way each name have 0 n telephone numbers associated it.
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment