‫All right, so now let's get all students from a specific university.
‫So let's create a new method, because we have seen multiple methods already to get data, to change
‫data, to set up data, to combine data.
‫And now let's just search for data.
‫So let's create a method called get all students from Yale, and you can try to build that or implement
‫that method yourself.
‫So pause the video if you feel like it.
‫All right.
‫So I'm creating a new variable called Students from Yale, and that will end up being a collection of
‫innumerable and from student in data context dot students.
‫I want to check where the student dot university dot name is equal to Yale and I want to select that
‫student.
‫So that's nothing too new.
‫The only thing that is different is that we had this in data context students and students at university
‫name that is slightly different to what we have seen so far, but that's pretty cool because now we
‫get a list of all the students who are at the University of Yale and with just this one line, well,
‫it's actually one line, but in this case, it's three lines.
‫All right.
‫So now if we want to set that as the item source, we can just set that up.
‫Item source will be students from Yale.
‫Now let's check out that method.
‫Let's run it in our main method here, our main window constructor.
‫And here it's get all students from Yale.
‫All right, now let's see what is displayed to us.
‫And we are the only two students.
‫It's Carla and Toni, because the other ones are at another university.
‫They are at the Beijing Tech University.
‫Right.
‫All right.
‫So there you are.
‫You see the ID, the name, the gender and the university ID, then student lecturers and university
‫as well, who are or which are empty.
‫But that's based on all of the other stuff that we have run.
‫All right.
‫So that's how you can get all students from Yale.
‫All right.
‫And now let's go ahead and create a new method, public void, get all universities with transgenders.
‫So let's say there is in whatever country there is a support for universities who will have transgenders
‫and then to get additional funds or something like that.
‫Then you would run this method and it will give you all the students who are transgender and will give
‫you even all the universities who have transgenders.
‫So that's the actual return that we get here.
‫So let's create a new variable here.
‫Trans gender universities who are from student in data context students.
‫So we want to have students first of all, but then we want to join them.
‫So we want to join university.
‫And here university
‫in and this one is an on capital one.
‫So I create a new value here, join university in data context universities and I apply that on student
‫university.
‫So here I join two tables with each other and then I check where the university, and then I check university
‫because here we're joining it right now.
‫I can go ahead and choose that and I can check where the student the gender is equal to transgender.
‫And I want to select.
‫And what do I want to select?
‫Well, I don't want to select the student this time.
‫I want to select the university this time.
‫All right.
‫So now.
‫I need to use a double exclamation equals sign because I'm comparing and not setting a value.
‫And now just to make sure that the trend gender is written correctly.
‫All right.
‫It seems correct.
‫So that's how I wrote it.
‫And now I can show that on my data grid.
‫So items source is going to be transgender universities.
‫All right.
‫So if we call that method here, get all universities with transgenders.
‫And if you run that, we see that only Beijing Tech has transgender students.
‫All right.
‫So that's how you can generally join tables and play around with them.
‫And yeah, you see, it's done with C-sharp.
‫Everything is done with C-sharp here.
‫And no SQL or SQL code that we have to write manually now was a little challenge for you.
‫We want to have all the lectures which are taught at Beijing Tech.
‫Okay.
‫I hope you tried it.
‫That one is also pretty tough.
‫So if you manage to do that great job, get all lectures from Beijing Tech.
‫Now let's see.
‫What do we need?
‫Well, we need a variable called lectures from Beijing Tech.
‫And I check from my.
‫Student lectures in data context student lectures.
‫I join student that and in the data context of student on to my sl dot student ID which equals the student
‫ID
‫where my student dot university name is equal to Beijing Tech.
‫So plenty of thinking here.
‫That's really a tough one.
‫So if you manage to do that, really, that's that's great because then you quite understood what we're
‫doing here, right?
‫So lecture as well, that lecture.
‫So generally, what are we doing?
‫And by the way, there are multiple ways to solve that.
‫It's best to maybe not solve that with one query, but in our case, we're just fine doing it.
‫All right, so we loop the relationship table between student and lecture and simply check if the associated
‫student is from Beijing Tech.
‫If yes, we select that Associated Lecture.
‫All right.
‫So this is, as I said, this is a more complex one.
‫And this is really just to show you that we can connect to tables that have quite a far distance from
‫each other.
‫And by far, I mean, they are not really that related to each other.
‫But we can still do this connection because what we are doing is we get all the lectures from a specific
‫university and if we check that here, this is lecture and this is university, and they are so far
‫away because university is only connected to student and lecture is only connected to student lecture,
‫but student lecture is connected to student.
‫And that's what we need to do here.
‫We need to join them in a way that we get all the information that is required.
‫So that's why this one is a rather tricky one.
‫And if you manage to do that, great.
‫And if you didn't, no worries.
‫Then in order to display those, we use it as the item source again, which will be lectures from Beijing
‫Tech.
‫Now let's call this method here, get lectures from Beijing Tech and now let's run the code.
‫And we are in Beijing Tech.
‫For some reason only history is taught.
‫And why is that?
‫So if we check it out what we have done so far.
‫So we have created Layla and who's female and Jane who are with transgender, and those two are at Beijing
‫Tech.
‫And the problem here is that Jane doesn't even have a lecture.
‫So we haven't assigned a lecture to Jane and we have only assigned a lecture to Leslie.
‫And if we check it out here lately, has the context.
‫It's somewhere here.
‫Leslie has only history.
‫So we have no student who learns or who has math as this lecture.
‫And that's why we don't have math at Tech University, which shouldn't happen.
‫Right?
‫So a tech university should definitely have math as their subject or as the lecture.
‫All right.
‫So now I'm just going to show you two more things.
‫And I think it's best if we do that in the next video.
‫So we will see how to update data and how to delete data.
‫So see you in the next video.