Alternative to lots of booleans in MySQL?

let's say I have a checkbox search form like this:

Check all that interests you:

  • bowling
  • billiard
  • sweets
  • Can I request this data from a database instead of having to resort adding tons of booleans to a database such as this?

    (VenueId, IfBowling, IfBilliard, IfSweets)

    And maybe just have one column that would contain all of those options that the venue itself has?


    Alternative .. sure .. easy :

    User table, Interests table, UserInterests table.

    UserInterests is used to store many-to-many relation between Users and Interests , and contains values which are FOREGN KEY s from said tables.

    PS You really should read SQL Antipatterns book. You would learn a lot from it.

    链接地址: http://www.djcxy.com/p/25136.html

    上一篇: Oracle中的布尔字段

    下一篇: 替代大量的MySQL布尔值?