1. We have moved to a new forum! There may be a few things not working properly so please let us know if you find a bug. Remember to use the bbCode [ sql ] tag for SQL statements.

Adding a constraint

Discussion in 'General DB Chat' started by AriesABCD, Jul 3, 2008.

  1. AriesABCD New Member

    I have a question on adding a constraint to a table.

    The following are my tables.

    1. Attribute table that will define the attributes
    Code:
    [U][B]Attribute[/B][/U]
    AtId       AtName
    1            Age
    2            Gender
    
    2. Attribute value table that will store value for attributes
    Code:
    [U][B]AttributeValue[/B][/U]
    AtValId     AtId               AtDesc
    1             1                    10 - 20
    2             1                    21 - 30
    3             1                    31 - 40
    4             2                    Male
    5             2                    Female
    
    3. User table that will contain list of users and their profile
    Code:
    [B][U]User[/U][/B]
    UserId    User Name         Age   Gender
    1           Matt thompson    2        4
    
    Is there any way to set a constraint on the columns Age and Gender of User table to have the values only from attribute table?

Share This Page