Difference between revisions of "Space Race/MATCH Tutorial"
From NoSQLZoo
ChrisHouston (talk | contribs) |
ChrisHouston (talk | contribs) |
||
Line 7: | Line 7: | ||
[http://nosqlzoo.net/mw/visproject/visualisation.php Click here for 3d graph visualisation] | [http://nosqlzoo.net/mw/visproject/visualisation.php Click here for 3d graph visualisation] | ||
− | == | + | ==Institutions== |
<div class="q nonum" data-lang="neo4j"> | <div class="q nonum" data-lang="neo4j"> | ||
− | Use MATCH and RETURN to show nodes that are Institutions rather than Astronauts | + | Use <code>MATCH</code> and <code>RETURN</code> to show nodes that are Institutions rather than Astronauts |
<p class='strong'>Show Institutions instead of Astronauts<p> | <p class='strong'>Show Institutions instead of Astronauts<p> | ||
<pre class="def"><nowiki>MATCH(n:Astronaut) RETURN n;</nowiki> | <pre class="def"><nowiki>MATCH(n:Astronaut) RETURN n;</nowiki> | ||
</pre> | </pre> | ||
<pre class="ans"><nowiki>MATCH(n:Institution) RETURN n; </nowiki> | <pre class="ans"><nowiki>MATCH(n:Institution) RETURN n; </nowiki> | ||
+ | </pre> | ||
+ | </div> | ||
+ | |||
+ | ==Born in Russia== | ||
+ | <div class="q nonum" data-lang="neo4j"> | ||
+ | Use <code>WHERE</code> to specify conditions | ||
+ | <p class='strong'>Show Astronauts born in Russia rather than the USA <p> | ||
+ | <pre class="def"><nowiki>MATCH(n:Astronaut)-[:BORN_IN]-(c:Country) WHERE c.name = 'United States of America' RETURN n;</nowiki> | ||
+ | </pre> | ||
+ | <pre class="ans"><nowiki>MATCH(n:Astronaut)-[:BORN_IN]-(c:Country) WHERE c.name = 'Russia' RETURN n;</nowiki> | ||
</pre> | </pre> | ||
</div> | </div> | ||
{{Acknowledgements}} | {{Acknowledgements}} |
Revision as of 09:03, 27 November 2019
MATCH
Click here for 3d graph visualisation
Institutions
UseMATCH
andRETURN
to show nodes that are Institutions rather than Astronauts
Show Institutions instead of Astronauts
MATCH(n:Astronaut) RETURN n;
MATCH(n:Institution) RETURN n;
Born in Russia
Use WHERE
to specify conditions
Show Astronauts born in Russia rather than the USA
MATCH(n:Astronaut)-[:BORN_IN]-(c:Country) WHERE c.name = 'United States of America' RETURN n;
MATCH(n:Astronaut)-[:BORN_IN]-(c:Country) WHERE c.name = 'Russia' RETURN n;
Acknowledgements
NoSQLZoo is made possible by the following open-source technologies: