Question

using SQL Build an procedure to calculate Age, the year of birth will be entered when...

using SQL Build an procedure to calculate Age, the year of birth will be entered when the procedure is called. ***The current year will be brought from within the system.

Homework Answers

Answer #1

**I request you to please provide a positive rating.**

Answer)

DECLARE @dateofbirth datetime
SET @dateofbirth ='1992-01-09 00:00:00'

SELECT DATEDIFF(hour,@dateofbirth ,GETDATE())/8766.0 AS AgeYearsDecimal
,CONVERT(int,ROUND(DATEDIFF(hour,@dateofbirth ,GETDATE())/8766.0,0)) AS AgeYearsIntRounded
,DATEDIFF(hour,@dateofbirth ,GETDATE())/8766 AS AgeYearsIntTruncated

By executing the above procedure, we can get the Output as below

AgeYearsDecimal :17.767054

AgeYearsIntRounded:18   

AgeYearsIntTruncated : 17   

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
A Guide to SQL Questions 1. How do you create a table using SQL? 2. How...
A Guide to SQL Questions 1. How do you create a table using SQL? 2. How do you delete a table using SQL? 3. What are the common data types used to define columns using SQL? 4. Identify the best data type to use to store the following data in Oracle, in SQL Server, and in Access:    a. The month, day, and year that an employee was hired    b. An employee’s Social Security number    c. The department...
When a medical diagnostic procedure does not detect the disease that is really present it is...
When a medical diagnostic procedure does not detect the disease that is really present it is called a “false negative”. In testing a new diagnostic procedure, a random sample of 180 patients with the disease, the new procedure yielded 16 “false negatives”. a. Estimate the true proportion of all cases the diagnostic will yield a false negative, using 95% confidence. (18) b. Verify that the sample size used in part A is large enough for the procedure to be considered...
Birth weight and gestational age. The Child Health and Development Studies considered pregnancies among women in...
Birth weight and gestational age. The Child Health and Development Studies considered pregnancies among women in the San Francisco East Bay area. Researchers took a random sample of 50 pregnancies and used statistical software to construct a linear regression model to predict a baby's birth weight in ounces using the gestation age (the number of days the mother was pregnant). A portion of the computer output and the scatter plot is shown below. Round all calculated results to four decimal...
Birth weight and gestational age. The Child Health and Development Studies considered pregnancies among women in...
Birth weight and gestational age. The Child Health and Development Studies considered pregnancies among women in the San Francisco East Bay area. Researchers took a random sample of 50 pregnancies and used statistical software to construct a linear regression model to predict a baby's birth weight in ounces using the gestation age (the number of days the mother was pregnant). A portion of the computer output and the scatter plot is shown below. Round all calculated results to four decimal...
Using the statistical procedure THE WILCOXON SIGNED RANK TEST that makes use of the magnitudes of...
Using the statistical procedure THE WILCOXON SIGNED RANK TEST that makes use of the magnitudes of the differences between measures and a hypothesized location parameter rather than just the signs of the differences. Sixteen laboratory animals were fed a special diet from birth through age 12 weeks. Their weight gain (in grams) were as follows: 63 68 79 65 64 63 65 64 76 74 66 66 67 73 69 76 Can we conclude from these data that the diet...
Using the THE WILCOXON SIGNED-RANK TEST Sixteen laboratory animals were fed a special diet from birth...
Using the THE WILCOXON SIGNED-RANK TEST Sixteen laboratory animals were fed a special diet from birth through age 12 weeks. Their weight gain (in grams) were as follows: 63 68 79 65 64 63 65 64 76 74 66 66 67 73 69 76 Can we conclude from these data that the diet results in a mean weight gain of less than 70 grams? Let α = 0.05. Note: There are two possible ways to analyze this data. Use the...
A one-year long forward contract on Amazon is entered into when its stock price is $1,900...
A one-year long forward contract on Amazon is entered into when its stock price is $1,900 and the continuous compounded interest rate is 2.5%. (Note: Does Amazon pay dividends?) a) What are the fair forward price and the initial value of the forward contract? b) If the forward price is set at $1,950, how would you arbitrage it? c) Six months later, the stock price of Amazon rises to $2,000. What are the current fair forward price and the current...
On February 1, 2021, Arrow Construction Company entered into a three-year construction contract to build a...
On February 1, 2021, Arrow Construction Company entered into a three-year construction contract to build a bridge for a price of $8,210,000. During 2021, costs of $2,070,000 were incurred with estimated costs of $4,070,000 yet to be incurred. Billings of $2,570,000 were sent, and cash collected was $2,320,000. In 2022, costs incurred were $2,570,000 with remaining costs estimated to be $3,705,000. 2022 billings were $2,820,000 and $2,545,000 cash was collected. The project was completed in 2023 after additional costs of...
At what age do babies learn to crawl? Does it take longer to learn in the...
At what age do babies learn to crawl? Does it take longer to learn in the winter when babies are bundled in clothes to restrict their movement? Data was collected from parents who brought their babies to New York University Infant Study Center to participate in one of a number of experiments between 1988 and 1991. Parents reported ages (in weeks) at which their child was first able to crawl a distance of four feet within one minute. The researchers...
When using 3 grams of benzoin to oxidize to benzil, calculate the theoretical yield. Procedure: 2...
When using 3 grams of benzoin to oxidize to benzil, calculate the theoretical yield. Procedure: 2 boiling stones are added to a 400-mL beaker half-full of water, then placed on a hot plate to boil. 3 grams of benzoin and 7 mL of concentrated nitric acid are then added to a 125 mL Erlenmeyer flask and placed in the boiling water bath and left to boil until the evolution of nitrogen dioxide has ceased. Then, 50 mL of ice-cold water...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT