For SSDs, Dell's response to a simular question:
6. I have unplugged my SSD drive and put it into storage. How long can I expect the drive to retain my data without needing to plug the drive back in?
It depends on the how much the flash has been used (P/E cycle used), type of flash, and storage temperature. In MLC and SLC, this can be as low as 3 months and best case can be more than 10 years. The retention is highly dependent on temperature and workload.
NAND Technology
Data Retention @ rated P/E cycle
SLC ... 6 Months
eMLC .. 3 months
MLC .. 3 Months
have seen reponse to this quest that suggest 10Years for SLC and 8 Months to 1 yr for MLC. But Highly dependent on Temperature, die size of nand, and quality of NAND chips.
On other media.
CDs very good, have some cds over ten yers old that still work.
DVDs commercial ons seam to be quite Long, But the Garden varity DVD write once and DVD =/- R can be very short. There are several posts that indicat movies stored (not the commersial version) data degregation can occure in as little as 6 months. HIGHY dependent on temperature/RH. For Long term Data retention use Class M DVD disk - NOT not all DVD writers are certified for Class m writes.
HDD. Biggest problem here is magnetic domain migration. This is when the domain is opposite the domain next to it. Like putting to magnet next to one another. Newer platters have gone to perpendicular domains, and are "packed" at a much higer density. Just not sure how long, but over time the data on magnetic platters also become unreliable. Newer HDDs may be shorter than the "older" HDDs. Had some OLD SCSI 2 gig High end drives that were stored for 4 years, some survived, some didn't. Most here do NOT normally stich a HDD up for 4 to 5 years and then retrive data from the HDD.