Professional Web Applications Themes

multiple data types in column? - MySQL

I need to store key value pairs for an article in a database. Articles have unique ids. There are varying number of fields of different types. I've tried giving each field a column but some fields can appear more than once, so right now I have a mess of tables. I was thinking it would be nice to have one table with the columns: id, field, value. I can do that with one type at a time, like TEXT or INT or VARCHAR(255) but is it possible to put different types in the same column? I want to be able ...

  1. #1

    Default multiple data types in column?

    I need to store key value pairs for an article in a database. Articles
    have unique ids. There are varying number of fields of different
    types. I've tried giving each field a column but some fields can
    appear more than once, so right now I have a mess of tables.

    I was thinking it would be nice to have one table with the columns:
    id, field, value.

    I can do that with one type at a time, like TEXT or INT or
    VARCHAR(255) but is it possible to put different types in the same
    column? I want to be able to SELECT * WHERE value = 2 and have that
    also search for "2" in TEXT/VARCHAR fields.

    Can I use a BLOB with type casting? is that a good idea?

    techcalgary@hotmail.com Guest

  2. Moderated Post

    Default Re: multiple data types in column?

    Removed by Administrator
    lark Guest
    Moderated Post

  3. Moderated Post

    Default Re: multiple data types in column?

    Removed by Administrator
    Captain Guest
    Moderated Post

Similar Threads

  1. Q about column types
    By _Raven in forum MySQL
    Replies: 1
    Last Post: August 31st, 03:45 PM
  2. Replies: 4
    Last Post: May 22nd, 05:58 PM
  3. multiple data items in each column
    By xzzy in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: April 18th, 08:59 PM
  4. Overriding column types
    By Robert in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: March 7th, 08:15 PM
  5. Column Types
    By Brad in forum Macromedia Dreamweaver
    Replies: 0
    Last Post: July 22nd, 04:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139