Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CREATE CYPHER QUERIES FOR THE FOLLOWI NG FIVE QUESTIONS This assignment will give you practice writing Cypher queries on a graph database while also furthering

image text in transcribedimage text in transcribed

CREATE CYPHER QUERIES FOR THE FOLLOWING FIVE QUESTIONS

image text in transcribed

This assignment will give you practice writing Cypher queries on a graph database while also furthering your SQL practice on a relational database. To do this, we will use both relational and graph versions of the well-known Northwind Traders retailer data. Note that the relational and graph versions have slightly different data, so your queries for each will not return exactly the same results in all cases (the results across the two DB implementation will be similar). You can access the graph (Neo4j server) version of the Northwind database via a web-browser here e (type "northwind" for both the username and password). Naturally, for this graph DB we must use Cypher-format queries. After logging in to this Neo4j-server link, ensure the database is running by clicking on the drive symbol at upper- left and selecting "Northwind." demo.neo4jlabs.com:7473/browser/ Database Information northwind$ Use database northwind To enjoy the full Neo4j Browser experid Node Labels northwind$ :use northwind "(1,035) Category Customer Order Product Supplier Relationship Types Use database You have updated what database to use in the Neo4j dbms. *(3,139) ORDERS PART OF PURCHASED SUPPLIES Property Keys The graph database design corresponds to the output you see here. northwind$ call db.schema.visualization "15) Order(1) Category(1) Customer(1) Product(1) Supplier(1) Graph *(4) ORDERS(1) PART OF(1) SUPPLIES(1) PURCHASED(1) Table A Category Supplier SUPPLIES PART OF Product Code Order PURCHA Customer Graph node/edge properties ("attributes") are as follows... Nodes Customer- customerld, address, city, company Name, contactName, contactTitle, country, fax, phone, postalCode, region Order - orderlD, employeeld, freight, orderDate, requiredDate, shipAddress, shipCity, ship Country, shipName, shipPostalCode :Category - categoryName, description Product - productID, productName, categoryID, discontinued, quantityPerUnit, reorderLevel, supplierID, unitsInStock, unitsOnOrder, unitPrice :Supplier - supplierID, company Name, address, city, contactName, contactTitle, country, fax, homePage, phone, postalCode, region Edges ORDERS - quantity, unitPrice, discount :PART_OF - :PURCHASED - SUPPLIES - 1. Show all products details' that are in the Beverages" category 2. For each product category name, show how many different products are in it. 3. For each product category name, show the total amount, before any discounts, from all items ordered (i.e., by customers) in that category. 4. Similar to the last question, but across all product categories (i.e., just report one grand-total #), show the total amount, ignoring shipping costs and discounts, from all items ordered. 5. Show a list of Beverage products' names that have a higher-than-average price (compared to all product prices). Hint: for SQL you need a SELECT in SELECT approach (subquery) whereas for Cypher you need a MATCH followed by a 2nd MATCH. This assignment will give you practice writing Cypher queries on a graph database while also furthering your SQL practice on a relational database. To do this, we will use both relational and graph versions of the well-known Northwind Traders retailer data. Note that the relational and graph versions have slightly different data, so your queries for each will not return exactly the same results in all cases (the results across the two DB implementation will be similar). You can access the graph (Neo4j server) version of the Northwind database via a web-browser here e (type "northwind" for both the username and password). Naturally, for this graph DB we must use Cypher-format queries. After logging in to this Neo4j-server link, ensure the database is running by clicking on the drive symbol at upper- left and selecting "Northwind." demo.neo4jlabs.com:7473/browser/ Database Information northwind$ Use database northwind To enjoy the full Neo4j Browser experid Node Labels northwind$ :use northwind "(1,035) Category Customer Order Product Supplier Relationship Types Use database You have updated what database to use in the Neo4j dbms. *(3,139) ORDERS PART OF PURCHASED SUPPLIES Property Keys The graph database design corresponds to the output you see here. northwind$ call db.schema.visualization "15) Order(1) Category(1) Customer(1) Product(1) Supplier(1) Graph *(4) ORDERS(1) PART OF(1) SUPPLIES(1) PURCHASED(1) Table A Category Supplier SUPPLIES PART OF Product Code Order PURCHA Customer Graph node/edge properties ("attributes") are as follows... Nodes Customer- customerld, address, city, company Name, contactName, contactTitle, country, fax, phone, postalCode, region Order - orderlD, employeeld, freight, orderDate, requiredDate, shipAddress, shipCity, ship Country, shipName, shipPostalCode :Category - categoryName, description Product - productID, productName, categoryID, discontinued, quantityPerUnit, reorderLevel, supplierID, unitsInStock, unitsOnOrder, unitPrice :Supplier - supplierID, company Name, address, city, contactName, contactTitle, country, fax, homePage, phone, postalCode, region Edges ORDERS - quantity, unitPrice, discount :PART_OF - :PURCHASED - SUPPLIES - 1. Show all products details' that are in the Beverages" category 2. For each product category name, show how many different products are in it. 3. For each product category name, show the total amount, before any discounts, from all items ordered (i.e., by customers) in that category. 4. Similar to the last question, but across all product categories (i.e., just report one grand-total #), show the total amount, ignoring shipping costs and discounts, from all items ordered. 5. Show a list of Beverage products' names that have a higher-than-average price (compared to all product prices). Hint: for SQL you need a SELECT in SELECT approach (subquery) whereas for Cypher you need a MATCH followed by a 2nd MATCH

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Students also viewed these Databases questions