Hello guys.
So in this section of the video we are going to probably go ahead and create this nodes relationship
properties labels.
You know and we'll try to see that how this entire information is basically created with the help of
Cypher Query language okay.
Very important video altogether because this will actually help you to understand how to write a specific
query.
So here, uh, first of all, you as soon as you open your Neo4j's Auradb, once you go inside this
particular instance, you'll be able to see this particular text box.
And this is where you write your own query right now, let us go ahead and try some of the queries over
here, and we'll see that how we can go ahead and create nodes, relationship property keys and many
more things okay.
So let's go ahead.
So first of all what I'm actually going to do I'm going to go ahead and use this create keyword.
And let's create our first node okay.
So I will just go ahead and write node Node one okay.
So once I create this create node one.
So it is just going to create my first node.
And once I execute this here you will be able to see that hey node one is basically created.
Okay.
But I'm not able to see this node one right.
If I go ahead and click this it shows hey I've I've assigned some ID over here.
This ID value is zero.
Okay.
So I told you that whenever we try to create nodes, nodes are nothing but entities.
Name something like that.
Right.
And obviously over here I did not provide any kind of information over here when I probably created
this particular node, because I need to provide some kind of labels.
Right.
If I say, hey, I'm going to create a node one, let's say node one is something over here.
And if I give a name like Krishna, then this particular node name will be assigned to Krishna.
Right.
right?
So let me just go ahead and uh, in order to return everything you can see match n that is nothing but
nodes return n limit 25.
Okay.
So now let me just go ahead and create another node.
So I will go ahead and write create node.
And you can create multiple nodes also.
But here what I'm actually going to do I will just go ahead and create one of the node.
And along with that I will just go ahead and assign some kind of labels.
Okay.
Now when I say I'll be assigning some kind of labels, what does this basically mean?
So let's say I will go ahead and write Ellen okay Elon Musk okay.
And this is my node that I'm actually creating.
And let's say I'll go ahead and write.
He's the CEO right.
So once I execute this you'll be able to see now I'm able to see one of the node which is called as
CEO.
Okay.
My my node is Ellen.
But over here I have tried to assign some kind of label value which is called as CEO.
Okay.
Otherwise I could have created another node like famous personality and I could assign one of the label
like Ellen.
Right.
So this way I can now see my nodes over here.
Okay, so if I really want to go ahead and see, like who is the CEO?
So if I just go ahead and create over here, here you'll be able to see this particular information.
Right.
And uh, once I go ahead and click this okay.
This shows the node details.
This is my CEO.
The key ID value is one okay.
So till here I hope you got an idea of how to properly create a node.
Right.
And here you can see as soon as I clicked on CEO it gave me a result where match n colon Co return n
limit 2525 basically means 25 results is allowed to retrieve.
And here I can probably see one of them.
Okay.
So I hope you got an idea with respect to creating a simple way of this kind of nodes.
Okay, now let me do one thing.
Let me just go ahead and create one more type here.
I will go ahead and write Ellen okay Okay.
Ellen I will create this particular node here.
I will go ahead and say he is also a CEO right of Tesla.
Along with that he is also an employee.
So I'm going to create this now see here what exactly the CEO and employee will basically do.
CEO one is the label over here okay.
And uh here I'm trying to add some more labels.
Right.
Like employees also one more label that I really want to create.
So if I go ahead and execute this here, you can see that now it has got executed and my one more node
has actually got created.
It is nothing but employee.
Right.
And if I go ahead and click on employee.
So this is my second node right.
Still CEO and employee.
There is no relationship.
So we are not able to probably see the entire relationship of this specific node.
Okay.
But here, if I write this query match n colon employees return n limit 25.
Okay.
So this is one of the query with respect to neo4j's.
So this all things we have actually tried okay.
And this is amazing because now we have also understood that fine we can create multiple labels okay.
Just with respect to one node.
So I hope you have very much clear with this basic things Right.
Now similarly, I can create different different nodes with lot of different information.
Okay.
Let's say I go ahead and write create Ellen okay.
And inside this I go ahead and write okay fine.
He is the CEO okay.
Now with respect to the CEO, I can go ahead and write some more information.
Now I know that this is my label, okay.
But being a CEO, this person has some kind of name.
Elon has name.
Right.
So I will go ahead and write my name called as Elon Musk.
So this is nothing but this is called as properties okay.
So here I'm trying to create a node with this label name and this property.
So I'll say hey Elon Musk over here.
I'll say okay let's go ahead and write this year of birth, let's say I will go ahead and write in 1979.
Okay, I hope so.
Uh, he was born in 1979 or some other date, but you can go ahead and validate it.
Okay.
And then let's say the place of birth I have heard is from South Africa.
Okay.
So I'll just go ahead and write SC okay.
Okay.
Perfect.
So here you can see that I have mentioned all this information.
And this is my property keys key value pairs.
These are my properties for this particular label okay.
Or I can also go ahead and probably inverse this entire information.
But right now we are able to to share or store this particular name and all.
So now let's go ahead and execute this.
Once I executed this you will be able to see.
Now I have this property keys name okay.
Name node is nothing but Elon Musk POB over here you can see node is South Africa and yob is nothing
but the node information is 1979.
So this information you are able to see that.
Yeah.
Now we have also created some kind of property keys.
Right.
And this is how the query is just there.
See if I really want to understand what is the value for this name.
So it is automatically creating this particular query match n where n dot name is not null Return distinct.
Return distinct node as entity and dot name as limit 25 Union all match this particular uh parameters
right R dot name is not null return distinct relationship as entity R dot name as name limit 25.
You'll be seeing that this all kind of queries will try to generate it from Lang chain.
So here the main idea is just to make you understand how quickly you can probably create your nodes,
your relationships and property keys right now.
I hope you are able to understand this now again, in order to get all the information out there, I
will just go ahead and write match and okay, so let's go ahead and write match end.
And here I'm just going to return end.
Let me go ahead and write this match end.
And here I'm just going to go ahead and return N okay.
So if I go ahead and execute this I will be able to see okay fine.
These are all my nodes that you can see over here.
If I go ahead and click on Elon Musk now you can see right.
So Elon Musk is one of the name over here.
Right.
And you are able to see all these values.
And this node details is nothing but CEO right.
So here you can see POB name Elon Musk.
Year of birth.
Every information is probably visible over here.
Right.
And this is amazing because here I made sure that I created my based on the name.
You can see the node name is basically assigned.
If you are not providing let's say if you have just provided label initially, the label will go away.
But if you provided some property key value pairs where you have name information that it has replaced
over here, right.
If you see another node two is here, one is over here.
This is my SEO details.
And uh, the other nodes itself.
Right.
So blank by blank you will be able to see this.
Yes I am able to see this.
Circular nodes each and everywhere.
Okay.
Perfect.
So I hope uh, you are able to understand this entire information.
Right.
And, uh, you are able to see that how we have easily created this entire nodes.
Okay.
Now let's go ahead and try to create relationships.
Okay.
Now you know that Elon Musk is the CEO of Tesla.
Okay.
Now if I really want to create first of all I need to create two entities.
Okay.
So let's go ahead and create this.
So here I will write okay I have already created Elon Musk okay.
Now let me just go ahead and write my uh, the Tesla company details.
So here I will write re create.
So I will just go ahead and write.
Create.
So this will be create.
Now inside create I will go ahead and write okay.
Let's say this is Tesla okay I will provide uh label over here called as company okay.
And with respect to this particular company, let me just go ahead and give some information in the
form of key value pairs.
So I'll say name.
Name is nothing but Tesla.
Okay.
So here you can see Tesla is the name of the company.
And this is the label.
So if I go ahead and execute it you'll be able to see I'm able to get the company.
So if I go ahead and just click this I'm able to see Tesla.
Okay.
Perfect.
Now I want to create a relationship between Elon Musk and obviously, uh, if I probably say Elon Musk
with Tesla right now here, you will be able to see that if I click on name, right, Elon Musk is there
and Tesla is there.
Right.
So, uh, how do I probably go ahead and do this?
So if I go ahead and click on company.
So this is company.
This is CEO okay.
And CEO these are my three information right.
So Elon Musk.
So let's let's see how we can probably join this okay.
Or how we can go ahead and create this relationship already if you know in the downwards direction.
If I go right here you will be able to see where I have actually used Elon.
Right.
So here I've created a node called as Elon.
Right now what I will write since there is already a node with the name Elon.
So if I go ahead and press this, I think uh, it was this one itself.
Right.
So let's see this.
The node is there.
So here what I will say I will create create Ellen okay.
And then I will put a relationship.
In order to put a relationship I have to use Dash I will use a are parameter.
And here I will say c e o c e o.
And here I'm just going to give this arrow direction and let me go ahead and write my another node.
Another node will be what my another node will be specifically for this particular company.
Right.
And the company name that I have actually created, a company node that I've actually created is what
Tesla.
Right.
So here what I'm actually going to write quickly, I will say hey go ahead and create this relationship
with Tesla.
Now once I execute this you'll be able to see created two nodes, created one relationship.
Now CEO is one of the relationship.
Now if I go ahead and click this see the magic okay.
So here you can see five is basically getting created.
Six is basically created.
Now what I have actually done is that I used this particular node Elon with Tesla.
And I don't know why Elon uh, when I see down okay, I had actually created this entire thing.
So spelling is wrong or correct.
Let's see Elon with CEO right.
So here 00000.
So if I go ahead and say Elon with CEO of Tesla it created two nodes.
but it is giving me this particular node name, right.
The reason is very simple, because this fifth and sixth is actually creating as a new node.
Okay.
It did not use the older nodes itself.
Okay.
So in order to do this let let's take one more very good example.
Okay.
I will just create it from scratch and then we'll get to know why that node name did not come okay.
So I'll say hey go ahead and create and let me go ahead and write my name.
Okay Chris, I will say, hey, I am a entrepreneur, okay?
I'm an entrepreneur.
This will be basically be my label.
And let me just go ahead and write name.
Oops name.
So here I will just go ahead and create my name.
And let's go ahead and write my name as Chris.
Okay Chris.
Krish.
After creating Krish, I will go and write my iob.
This will be nothing but 1989.
Okay.
Along with this, let me write place of birth.
And here I'm just going to write India.
Okay.
So all this information is there.
Okay.
Place of birth, India.
All these information with respect to this.
Everything is available over here.
Right.
And let me just go ahead and use this should be string.
Okay.
Now, uh, let's say that I'm going to go ahead and probably press enter.
Let's go ahead and create my another node okay.
So here I'm just going to write create okay.
And I will write I and India which is my country.
So here I'm going to write my country label and let's say here I use something called as label.
And here label will be name is equal to India okay.
I just want to specify that I live in India okay.
So that kind of relationship that I really want to put over here.
So Krish is a node name, my node.
Uh my node uh basically and this is given with a label called as entrepreneur name is Krish will be
b 1989 place of birth is India.
I created another node with country as my label and name is equal to India.
So once I execute this you'll be able to see.
Now I am having this entrepreneur okay Krish and country with India.
Okay so guys now once I have created this entrepreneur.
So let's double click this.
So here you'll be able to see that okay.
This is my node obviously with the label name entrepreneur.
And here I have crush right.
And if I just click over here you'll be able to see all this information.
But if I double click on this you can see that it shows the relationship that it is using lives in with
uh, the country India.
Right.
And if I just double click on this India here, you'll be able to see that all the values with respect
to India is also given.
This is one way of creating the relationship.
Okay.
but understand one thing guys.
Whenever we are working with huge databases, right when we have a huge amount of database, right?
With respect to tables, also we have different different information.
Let's say if I want to specify person name, I should definitely have a similar kind of labels used
everywhere, right.
So in order to just show you uh, let me do one more example.
Okay?
Let's say I'm going to create a node.
Okay.
So let's say this will be my node P.
And here I'm going to just use my person name okay.
So this will be my person okay.
Which is my label name.
And let's say here I'm going to specify as name.
Name is nothing.
But let's say one of the famous actor that is actually available is Tom Hanks.
I hope you have seen this movie.
You know, amazing movies that he probably creates.
And let's say this person is born in 1956.
So I will just go ahead and write 1956.
So here what I have actually done is that I have actually created an person, uh, a peep, uh, like
a node P with the name person.
And the name information is Tom Hanks, and person is born in 1956.
Okay.
so let me just go ahead and create another node.
So here I'm going to basically use another node which is called as movie.
And here my node will specifically become M.
I'm just mentioning M and we are going to make this node similar for every records that we enter.
So here I'm going to write M colon movie okay.
And here I'm going to use my title.
Along with that I will go ahead and use my, let's say, the movie that the person may have acted is
like Forrest Gump, okay, Forrest Gump.
And it was basically released and it's an amazing movie.
I think everybody should probably watch this movie because it is fun comedy.
It is so many things in this.
Right?
So here I will go ahead and write released and let me just go ahead and write 1994.
Okay.
So let's execute this.
So here you can be able to see that I've created two nodes.
One is with respect to person.
So Tom Hanks is over here with respect to movie Forrest Gump is over here.
The reason we have just used P as our node.
Because whenever we create a new person over there, again the properties will only change.
The name will change.
Similarly, whenever I add a movie right, the movie name will be changing.
The title will be changing.
Okay.
Now let me just go ahead and create a relationship between this movie and person.
The person has acted in the movie, so I'll just go ahead and create a relationship, okay.
Now, in order to create a relationship, first of all, I will what I will do is that I will do some
matching.
Okay?
So I will go ahead and write match.
And inside this match I will say, hey, let's go ahead and take p colon person.
So here I will just go ahead and take this person.
Um, and obviously I have to match with the exact name of the actor.
So here I will go ahead and write Tom Hanks.
So this is I hope this is the name of the actor.
Let's see, Tom Hanks okay.
Now once I do this, uh, then I will also do another match over here.
Okay, so this is with respect to the person name that I'm actually doing.
Let's do another match.
Uh, here I'm going to probably take m dot movie.
Right.
So if I go ahead and write this let me see whether the brackets are closed properly or not.
Yeah this looks good okay.
So I'll just go ahead and write m dot movie because movie is my, uh.
Sorry.
It should not be Dot.
It should be colon.
Okay.
Movie is my node name over here.
And again, I have to exactly use that particular title because I need to create a relationship.
So let me just go ahead and write title colon.
And let's see what is the movie name over here Forrest Gump okay.
It should be double R, but I'm just writing it as single R Forrest Gump.
Okay, so, uh, when I am probably executing this.
Okay.
So here, if I execute this, let's see what error I get.
Okay.
Will I get any error.
So here you can see query cannot conclude with match.
Must be a return clause.
I have to also go ahead and write a return clause.
So what I will do I will press press enter over here.
After doing this match I'll say hey let's go ahead and create this relationship where I will take my
P, which is my person.
I will create a new relationship which is called as acted underscore in right.
And with respect to this I will be creating a relationship with M.
Okay.
So this actually does a lot many things right.
And here you'll be able to see this entire thing that I've actually created a relationship.
Okay.
So here, uh, let me do one thing.
Let me, uh, let me remove this.
Okay?
Okay.
Sorry.
I think this got executed.
So we are not able to update this, so I will just update over here.
Okay.
So this is the same thing that we have actually done.
Okay.
Now let's go ahead and execute this.
Now here you can see no changes no record the query.
Build a Cartesian product between disconnected patterns.
Now what may be the problem okay I use double R over here.
No worries.
So let's go ahead and execute this.
Now it shows created one relationship.
This query builds a Cartesian product between the disconnected patterns.
And let's see okay whether the relationship is created or not I clicked on acting in acted in.
And here you can see Tom Hanks has acted in Forrest Gump's.
Okay.
The reason why we were able to get, uh, the previous warning over here, this one, it is because
I'm just trying to insert any kind of data over here, and it is just trying to find out the relationship
with respect to other labels also.
But this is how very beautifully we have actually created a relationship.
Right?
Similarly over here.
See we we did this libsyn and all.
So here uh, Chris lives in this information is over here.
9 to 10 over here.
9 to 10.
Because here we did not give any label name.
Right.
All this information we could see very much easily.
Now similarly here in acted in we have actually created this specific relationship.
So any number of relationship you can go ahead and probably get it.
You know, now there may be scenario that where I want to probably retrieve nodes and relationship okay.
So in order to do that, let's say if I go ahead and just execute this match P colon person name is
equal to Tom Ham.
So return P.
So I should be able to get Tom Hanks right.
Similarly if I want P with person and I'm using this colon actedin that basically means this is the
relationship that we are looking for.
And we are returning P and M.
So here you'll be able to see that I will be able to get both the nodes, but I'm not able to see the
relationship, the relationship.
If I really want to get then this is the query match p acted in return p limit.
Okay, now let's do one more thing okay?
Let's create one more, uh person okay.
And uh, then we will try to add some more information with respect to that particular person.
Okay.
So let's say over here I will say there is also one more actor which has uh, probably acted in forest
Graham.
Okay.
And if you see there are a lot of actors over there.
So here I'll just go ahead and copy this, okay.
I will say, hey, movie title, this is there.
So let's go ahead and okay this is for the relationship okay.
Um.
Mhm.
So let's see where the person we created this.
Right.
So here I'm going to create another person.
And let's say this will be an another actor that we are going to use.
Now see this.
This will be amazing.
I will say hey uh I know I have not acted it, but I'm just going to write.
Okay?
Crush.
I'm born in 1989.
I know, but I'm not acted over here, so I'll simply try to create a relationship.
So this will be my another person.
So here now if I go ahead and click on person.
So here Tom Hanks you can see and Chris you can see right now the next thing will be that I will try
to create a relationship between this movie that is Forrest Gump and Crush.
Right.
So I'm going to basically use this two information.
So if I go back down right, I've created this entire node.
Uh, so I'm also making sure that I'll create that relationship.
So I'll say match this for scrum.
Okay.
This is fine.
This is to get the query.
Okay.
And, uh, here how do I probably create the relationship here.
You can see this okay.
So let's copy this entire thing I will paste it over here okay.
And here I'm going to write crush okay.
Person name is nothing but crush movie title this so and so I have acted it.
Okay, so once I execute this now if I go and now see acted in, you'll be able to see two people are
acting over here.
Crush acted in this.
Tom Hanks acted in Forrest Gump.
And this is how you can probably go ahead and build your queries, and you can keep on writing multiple
things over here, okay.
For retrieving anything as such, just write the match keyword and automatically you'll be able to retrieve
all those information.
Okay, let's say, um, I need to also update different nodes and relationship because see, in Tom
Hanks, uh, the born in 1956.
Okay.
Let's say that okay, I have mistaken, I have to probably update it to 1957.
So I will just go ahead and write match.
And here I will write p colon person.
Okay.
okay.
And here I'm going to write my name.
Colon okay.
Name colon.
Let me just go ahead and write Tom Hanks okay.
So okay.
This time Tom Hanks okay.
So we are matching with this specific person information.
And then we are just going to write a set keyword.
So set is also there.
I'll just go ahead and write p dot bond is equal to 1957 okay.
Perfect.
And let's return this p.
Then I should be able to get this particular information.
So if I go ahead and click on Tom Hanks now you'll be able to see 1957.
Right.
So uh these were some of the queries again guys uh please write down the queries along with me for your
understanding.
Uh, it is, I don't know, like how we can probably download the script and all.
Uh, but let's see, uh, whether we'll be able to know cypher snippets saved click in this.
Uh, but according to this, I don't know whether we will be able to explore these queries or not,
but please go ahead and execute it from your side.
Okay.
And, uh, if you are getting any kind of issues, just let me know with respect to that okay?
But I hope you got an idea of creating a node of probably creating a relationship, of probably creating
property keys, you know, and how you can basically work with different things, right?
In the upcoming session, we will be discussing about more advanced queries as we go ahead.
Right.
So yes, this was it for my side.
I will see you all in the next video.
Thank you.