Week 10 Sample Solution
1. READ
What does the following query mean?
Sample Answer: This query is used to find shops that sold products of the brand "Mega" in the year 2021 without duplicated values.
2. UPDATE
Compare Figure 1 with Figure 3. What's the difference between their results?
Sample Answer: In Figure 1, the data type of "127.0" is a string. In Figure 3, the data type of 127.0 is float.
Verify whether the price of product "BED_3" has been correctly updated to 125.0.
Sample Answer:
Choose a shop and update its size to a different value.
Sample Answer: Assume the select shop's id is shop_15, and the size will be updated to big.
Update the "unitPrice" property of all Sale nodes to float.
Sample Answer:
Without changing the type of "quantity" for sale nodes, update the sale whose "SaleID" is "S000004969" to have a quantity of "5.0".
Sample Answer:
3. DELETE
What is the difference between "DELETE" and "DETACH DELETE"?
Sample Answer:
DELETE: The
DELETE
clause is used to delete nodes, relationships or paths. But it is not possible to delete nodes with relationships connected to them without also deleting the relationships.DETACH DELETE: This command extends the functionality of
DELETE
by automatically removing any relationships that the node is involved in before deleting the node itself.
Delete all nodes and relationships in the database.
Sample Answer:
Last updated