The common in these notions is that both refer to a kind of certification at the end of a type of education ended with an exam. One can obtain a degree only from a university or at the end of a type of education lasted for 3-4 years at least, and a diploma after a type of education lasted for 1-2 years or at the end of polytechnics or other types of educational institution where you can study a trade. To get a university degree, students have to take general education courses (electives) to obtain a more rounded knowledge. Note that in the United States, diploma refers to the certification students get at the end of high school. In the United Kingdom, it is called the General Certification of Education.