1

My code is working to an extent, but it doesn't give me the output that is required for my assignment and I'm not sure what is wrong with my code. If anyone can let me know, I would greatly appreciate it. Not sure why the third one is completely wrong either.

What it looks like:

enter image description here

What it's supposed to look like: enter image description here

SELECT s_first||' '||s_mi|| '. '||s_last AS "Full Name", s_dob AS "Date of Birth", TRUNC(MONTHS_BETWEEN(SYSDATE, s_dob)/12,2) AS "Age"
FROM student
WHERE s_dob LIKE '%86%'
ORDER BY s_dob;
Pரதீப்
  • 91,748
  • 19
  • 131
  • 172
user2268587
  • 179
  • 2
  • 2
  • 10
  • Look here: http://stackoverflow.com/questions/3015431/oracle-age-calculation-from-date-of-birth-and-today – Icemanind Jan 21 '15 at 04:33

1 Answers1

2

Except for, as Gordon mentions, using "like" on a date field, you don't have a problem. The answers you show as supposedly wrong are indeed correct -- for today's date. In fact, the answers you show as correct can only be correct if the current date is the 4th or 5th of September, 2014. (Assuming the "7.75" you show is actually "27.75".)

You appear to be trying to match the results of a report generated last year.

TommCatt
  • 5,498
  • 1
  • 13
  • 20