0

Anyone Could Describe for me what is the meaning of QTY > QTY(500) in following sentence?

CONSTRAINT DBC1 IS_EMPTY ((S JOIN SP) WHERE STATUS<20 AND QTY>QTY(500)); 

I translate it: status is lower than 20 and quantity is bigger that 500.

please note that just I need meaning of QTY> QTY(500)...

13
  • do you already have this constraint on your table? and do you already have any data in your table ? because mathematically QTY>QTY(500) can never evaluate to true. Also what RDBMS are you using ? MySQL , SQL Server, Oracle ?? Commented Oct 12, 2014 at 20:14
  • Dear @M.Ali, would you please say with any value, what is the meaning of this sentence? QTY>QTY(500)? I has a problem with meaning...without considering constraint and data. Commented Oct 12, 2014 at 20:16
  • The meaning is simple value of QTY is greater than QTY times 500 which will never be true. Even if QTY = 0 or QTY IS NULL. Commented Oct 12, 2014 at 20:18
  • it means 500 types of objects or if we have object A that has quantity 540, so A has QTY > 500 ? it's so simple? Commented Oct 12, 2014 at 20:20
  • 1
    Note that the language used here is NOT SQL. QTY(500) stands for the number 500, but it needs the typing construct because the concerned attribute (QTY) is declared to be of type QTY. Slightly confusing at first, but not impossible. Your "translation" is correct. Commented Oct 13, 2014 at 9:56

1 Answer 1

2

(S JOIN SP) contains a tuple for each shipment, and this tuple is "extended" with the details of the supplier, such as his status code.

The [result of the restriction defined by the] WHERE clause thus amounts to "shipments of quantity >500 whose corresponding supplier's status is <20".

The declaration overall thus says "there cannot be any shipments of quantity >500 whose corresponding supplier's status is <20.

Sign up to request clarification or add additional context in comments.

Comments