Hi, thank you for reading my post. I''ve got s simple question: What''s the correct technical term for data which IS NOT calculated and data which IS calculated regarding database design. Simple example: saving a user message in a corresponding table vs. counting all messages of a user. If you also know the german expressions, you''re welcome to post them, too. :) Thanks for your help, ms -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''m not sure if this answers your question in regards to your specific example, but let''s say you have a simple table with just two numerical columns, say two integers. SELECT i1, i2, i1+i2 AS "Sum" FROM MyTable will show three columns, two of them real columns from the table and one computed. So the term in this case is a COMPUTED column. Best regards, Rolf On Fri, Apr 30, 2010 at 2:16 AM, ms <ms-cGBD8117FJM@public.gmane.org> wrote:> Hi, > > thank you for reading my post. I''ve got s simple question: What''s the > correct technical term for data which IS NOT calculated and data which > IS calculated regarding database design. > > Simple example: saving a user message in a corresponding table vs. > counting all messages of a user. > > If you also know the german expressions, you''re welcome to post them, > too. :) > > Thanks for your help, > ms > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rolf Pedersen wrote:> I''m not sure if this answers your question in regards to your specific > example, but let''s say you have a simple table with just two numerical > columns, say two integers. > > SELECT i1, i2, i1+i2 AS "Sum" FROM MyTable > will show three columns, two of them real columns from the table and one > computed. > > So the term in this case is a COMPUTED column.The term "derived column" is technically (slightly) more accurate. ms wrote:> Simple example: saving a user message in a corresponding table vs. > counting all messages of a user.1. Saving user messages in a corresponding table. This would be called a "one-to-many relationship," or "association" for short. Example: user = User.first user.messages 2. Counting all messages of a user. These types of calculations are called called "aggregate functions." Example: user = User.first user.messages.count 2a. Caching aggregate functions. It''s also possible to store the results of aggregate functions in a column on the parent model. Rails has built-in support for this pattern, which is called a "counter cache." AFAIK Rails support the counter cache only. I''ve occasionally wished it had direct support for caching "sum" and "average" (avg) aggregate functions as well, but it can still be doe manually in a similar pattern as counter cache. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.