-
Notifications
You must be signed in to change notification settings - Fork 3
Rizan ibrahim w2 database #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Rizan ibrahim w2 database #16
Conversation
yunchen4
left a comment
There was a problem hiding this 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!
Week2/assignment/keys.js
Outdated
| 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 | ||
| ); | ||
|
|
||
|
|
||
| `); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
| // | ||
| 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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
| 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' | ||
| `); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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?
yunchen4
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
No description provided.