The National Defense Service Medal is awarded to any member of the Armed Forces who serves on active duty during a time of declared emergency. It is NOT awarded for graduation of basic training. If you happen to graduate DURING a time the NDSM is awarded, then you get it upon graduation, but is NOT awarded for graduating.
In the years since the creation of the National Defense Service Medal, it is authorized only for the following time periods:
June 27, 1950 to July 27, 1954 for service during the Korean War
January 1, 1961 to August 14, 1974 for service during the Vietnam War
August 2, 1990 to November 30, 1995 for service during the Gulf War
September 11, 2001 to a date to be announced for service during the War on Terrorism
If you only served between August 15, 1974 and August 1, 1990, for example, you would not be authorized the NDSM.