Hi, I have a question regarding a SQL query. I am a complete noob, so please do not make fun of me.
Here is a schema that I created:
JOURNALS(j_num, j_name, j_subject_area, chief_editor_r_ssn)
ISSUES(j_num, i_num, i_date, i_num_pages)
RESEARCHERS(r_ssn, r_name, r_address, r_phone, r_institution)
ARTICLES(art_num, art_title, art_area_topic, art_abstract, j_num_submitted,date_submitted, j_num_published, i_num_published)
AREA_EDITS(j_num, r_sssn)
WRITES(r_ssn, art_num)
REVIEWS(r_ssn, art_num)
RESEARCH_SPECIALTIES(r_spec_name)
RRS(r_ssn, r_spec_name)
It's pretty simple. My question is regarding the linking of the primary keys. Is it necessary to link the primary keys if I were doing something like: The number of journals for which researcher ‘Albert Einstein’ is the chief editor?
The SQL query I came up with is:
SELECT count (*), j.j_num
FROM journals as J, Researchers as R, Area_edits as AE
WHERE J.chief_editor_r_ssn=R.r_ssn
AND R.r_name="Albert Einstein"
AND R.r_ssn=AE.r_ssn
AND J.j_num=AE.j_num;
Is it necessary to include the last 2 steps, or are the unneeded?