Subject | Re: how to use the same column from a single table to other tables? |
---|---|
Author | dice_in_trouble |
Post date | 2013-05-03T16:26:50Z |
--- In firebird-support@yahoogroups.com, Norman Dunbar <Norman@...> wrote:
and btw how can I include formulas like from excel to my firebird database? I would like to sum up the total payments made in the collection and the balance on the clients table, which will appear at the bottom and cannot be edited unless I change or add a value to the balance and payment.
>OIC. Thank you very much norm for the informative and very useful post and example you have given me. I would love to buy a book on firebird but I don't have a credit card, and I cannot find one here in our country. I'm from the Philippines BTW. And also regarding database design what book is advisable for beginners like myself? Regarding the big int, floating int, etc. I can't still understand them. I just put decimal in the value for integers because I have a TButton that automatically computes the balance left (which was my first design). That formula was executed successfully, however, I have difficulty updating my collection (because it updates daily.)
> On 02/05/13 11:15, dice_in_trouble wrote:
> Hi Cedris,
>
> > Thank you for this wonderful post. Will try this now. Thank you again.
> You are welcome.
>
> I suggest you purchase a book on Firebird, as has been suggested, or at
> the very least, a decent beginner's guide to database design which will
> help you understand the subject.
>
> I have plans to do a Firebird Database Design manual for the
> documentation, but as with many things, time is not on my side! So,
> don't wait for me!
>
> One other thing, you might be wondering why I've put the COLLECTION
> table's payment column as a bigint rather than a floating pint of some
> kind? That was just for simplicity.
>
> Currency is a difficult subject to get exact values in when using a
> floating point data type (. It's best to use a fixed point data type of
> some kind (decimal) or count in pennies (in my case) (bigint) rather
> than in pounds and pennies.
>
> However, the data type DECIMAL(18,4) - means 18 digits wide with 4 of
> them appearing after the decimal - is useful for a CURRENCY type, so you
> could create a domain.
>
> CREATE DOMAIN CURRENCY AS DECIMAL(18,4);
>
> In the UK, that's £99,999,999,999,999.9999 - which is about my hourly
> rate! ;-) Seriously, it's a value between -2**63 and +2**63 -1.
>
> Why 18,4? If you are dividing, for some reason, monetary values, the
> extra precision will help avoid too many rounding errors.
>
>
> DECIMALs are good for counting currencies, but beware if the currency
> you are counting (or accumulating) could become very large - see above.
> The Italian Lira (as it was) for example, could soon fill a CURRENCY
> type. The Euro, might take a bit longer! And a DECIMAL is limited to 18
> digits.
>
> Have fun.
>
> Cheers,
> Norm.
>
> --
> Norman Dunbar
> Dunbar IT Consultants Ltd
>
> Registered address:
> Thorpe House
> 61 Richardshaw Lane
> Pudsey
> West Yorkshire
> United Kingdom
> LS28 7EL
>
> Company Number: 05132767
>
and btw how can I include formulas like from excel to my firebird database? I would like to sum up the total payments made in the collection and the balance on the clients table, which will appear at the bottom and cannot be edited unless I change or add a value to the balance and payment.