Question about databases/SQL

Discussion in 'Computer Software and Operating Systems' started by Lucifer666, Feb 22, 2017.

  1. Lucifer666
    OP

    Lucifer666 all the world needs is me

    Member
    1,495
    732
    Apr 22, 2011
    The Fourth Dimension
    Excuse the non-descriptive title; I couldn't think of a way to sum up the question into a few words.

    Suppose I have a relational database schema (as in, I have a database thought out into tables for the entities and relationships that can easily be implemented in SQL)

    Let's say I have a numeric attribute in Entity Type A. I want to enforce a rule along the lines of "Every time an entity X of Entity Type A is added to relationship A (with another entity), one of the attributes of that entity X increments by 1."

    Would/can this be done in SQL, or would this have to be implemented in whatever application software is accessing the database?

    Thanks