1,105,409 Community Members

how to create a derived attribute?

Member Avatar
silvercats
Posting Pro in Training
429 posts since Apr 2011
Reputation Points: 10 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 

there is a table. both "age" and "DOB" columns are there.
how to give a SQL command to make "AGE" a derived attribute from "DOB"?
thanks

Member Avatar
BitBlt
Practically a Posting Shark
895 posts since Feb 2011
Reputation Points: 442 [?]
Q&As Helped to Solve: 163 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

Not quite sure what you're asking for here. What do you mean by "derived attribute"?

If it is simply to derive an "AGE" column in a select statement, then you can just use the DATEDIFF function and specify the years between the DOB column and GetDate().

If you're looking for a "derived table", that's really nothing more than joining to a parenthesized "Select" statement. Frankly, in most cases you're better off using straight joins.

If you're talking about a Derived Column transformation in SSIS, then there's a Derived Column Transformation Editor in BIDS that will expose all the properties you need.

If none of these answer your question, please clarify what you're asking for, and perhaps describe more about your scenario.

Member Avatar
barb.saunders.5
Newbie Poster
3 posts since Dec 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi im a beginner in mysql land and i need exactly this i need to derive AGE from my D.O.B column i am wondering if you could explain whether i need to do this...

If it is simply to derive an "AGE" column in a select statement, then you can just use the DATEDIFF function and specify the years between the DOB column and GetDate().

and whether you could break it down more simply...

i know im asking alot but we all have to learn ..

hopefully

barb :D

Member Avatar
BitBlt
Practically a Posting Shark
895 posts since Feb 2011
Reputation Points: 442 [?]
Q&As Helped to Solve: 163 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

Hi, @barb.saunders.5 and welcome to DaniWeb.

Please note that this thread is for MS SQL, and you'd probably get a better answer if you posted in the MySQL database forum. There are syntax differences in the dialects of SQL for each of the platforms.

Member Avatar
barb.saunders.5
Newbie Poster
3 posts since Dec 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Ok thank you :D

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article