Skip to content

Conversation

@rizan-ibrahim
Copy link

No description provided.

@yunchen4 yunchen4 self-assigned this Jun 2, 2025
Copy link

@yunchen4 yunchen4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Rizan,
Overall your assignment is good. There are some points that you need rework. I have made them explicit. Please let me know on Slack when you finish the rework so I can review it again.
Don't hesitate to contact me if you have any questions!

Comment on lines 31 to 42
await connection.execute(`
create table research_Papers (
paper_id int auto_increment primary key,
paper_title varchar (100),
conference varchar (100),
publish_date date,
author_id INT,
foreign key (author_id) references authors(author_id) on delete CASCADE
);


`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw you created two research_papers tables. One here and the other in relationships.js.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i had to check twice u are right.im gonna fix it

Comment on lines 11 to 28
//
const authorMentorRows = await connection.execute(`
select a.author_name AS author, m.author_name AS mentor
from authors a
left join authors m ON a.mentor = m.author_id
`);
console.log("Author and their mentors:");
console.table(authorMentorRows);

//
const [authorPapersRows] = await connection.execute(`
select a.author_name, r.paper_title
from authors a
left join author_paper ap ON a.author_id = ap.author_id
left join research_papers r ON ap.paper_id = r.paper_id
`);
console.log("Authors and their research papers:");
console.table(authorPapersRows);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rework: These two questions are answered in joins.js file. However you missed one question: All research papers and the number of authors that wrote that paper.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u are right thanks for comment i will fix it

Comment on lines 31 to 36
const [femalePaperCount] = await connection.execute(`
select count(*) as total_female_papers
from author_paper ap
join authors a ON ap.author_id = a.author_id
where a.gender = 'female'
`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rework: If several female authors contribute to the same paper, will the query count the same paper multiple times?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, but should I avoid it or what?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, when I read this problem I feel like no duplicate papers - but I might be wrong. So if you encounter this situation in your future work, always check it with your PM 😉 It's like an edge case.

Comment on lines 51 to 54
select a.university, count(ap.paper_id) as total_papers
from authors a
join author_paper ap ON a.author_id = ap.author_id
group by a.university
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rework: If several authors from the same university contribute to the same paper, will the query count the same paper multiple times?

Copy link

@yunchen4 yunchen4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants