Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 465181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:21:01+00:00 2026-05-12T23:21:01+00:00

i have an Applications table and a Resources tables. Since many resources can work

  • 0

i have an Applications table and a Resources tables. Since many resources can work on a single application and many applications can be worked on by a single resource, i created a 3rd table:

ApplicationResources:
– ID (int)
– ApplicationID (int)
– ResourceID (int)
– PctOfTime (float)

is there anyway in the database itself that i can ensure that the total of all resources’s PctOfTime added up to 100%?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:21:02+00:00Added an answer on May 12, 2026 at 11:21 pm

    There’s no declarative way to do that in SQL.

    You can accomplish this using a trigger (a stored procedure that is run whenever a row in the ApplicationResources table is INSERTed, UPDATEd or DELETEd. The trigger can test the condition and reject the change if it would cause the condition to be false.

    The problem is that you might need to allow the table to be briefly invalid. For instance, if you DELETE a record for a resource, the condition will not be true until you add or update one or more records to get back to 100%. In order to get that to work, you’d need to defer your trigger until the end of a transaction and the ability to do that varies among databases.

    Your problem is easier to deal with if you want the condition to be that no resource can ever be more than 100% allocated (and that allows for resources that are not fully utilized as well).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, a user table and a application table: User id username
I have 3 tables called: Applications (id, name) Resources (id, name) ApplicationsResources (id, app_id,
I have an abnormally large table for one of my applications in MS Access.
I have an application that records activity in a table (Oracle 10g). The logging
I have an application which has a Projects table and a Users table. In
I have an application that has a status table see Database best practices -
I have an application that loads a cell in various table views. I want
I have an application where I move data from one table to another on
I have an application in which I'm currently using a two column table in
I have an application that shows data from a MySQL table. Basically, my application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.