Skip to content
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

add basic join (inner join) example #32

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cindyuc
Copy link

@cindyuc cindyuc commented Dec 2, 2022

Name: Xinyu Chen
Email: [email protected]
GTID: 903612905 % 14 = 13

Group 2, Topic 13: Write a toy C++ example to illustrate a basic join algorithm

For this topic, I implemented a simple join algorithm that utilizes inner join with hashmap.

There are 2 tables in the example:

student:

ID Name Age Major
1 Alice 19 CS
2 Jonah 20 EE
3 Charlie 19 CS
4 David 22 EE
5 Eve 18 CS

grades:

ID Course Grade
1 CS101 A
1 EE200 B
2 CS101 C
4 EE200 B

After joining these 2 tables based on the ID that students.ID = grades.ID, we will get

ID Name Age Major ID Course Grade
1 Alice 19 CS 1 CS101 A
1 Alice 19 CS 1 EE200 B
2 Jonah 20 EE 2 CS101 C
4 David 22 EE 4 EE200 B

To run the unit tests, please use the following commands:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug  ..
make check
ctest -R innerjoin_test -V

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant