Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2012
    Posts
    5

    How to restrict the amount of seats in my DB?

    I am building a project in Visual Studio 2010 using the MVC3 framework but I am little unclear on the design of my database and how to restrict the amount of seats that can be booked. The amount of seats cannot exceed 50.

    BookingVenueTable
    BookingID (PK)
    CustomerID (FK)
    ShowID(FK)
    VenueID (FK)
    ShowDate
    SeatNumber

    I was thinking of making a SeatTable, as a FK? but if I did this could I have a boolean value to say if the seat is taken or not but then how could I restrict the amount available to 50?

    All comments very welcome!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Have you covered Unique Constraints in class yet?

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Apr 2012
    Posts
    5

    Unique constraints

    I have not covered unique constraints in class yet. I will research into this I guess its a class associated to the database that applies a constraint to the amount of entries that a table can hold?

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Quote Originally Posted by Campbells View Post
    a constraint to the amount of entries that a table can hold?
    Not the way you phrased it. However, you can have a check constraint that ensures the values in a column do not exceed certain value.

  5. #5
    Join Date
    Apr 2012
    Posts
    5
    Quote Originally Posted by n_i View Post
    Not the way you phrased it. However, you can have a check constraint that ensures the values in a column do not exceed certain value.
    Would this be best applied to the SeatID that would be an int?

Posting Permissions

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