Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Latest commit

 

History

History
28 lines (23 loc) · 912 Bytes

modifying-data.md

File metadata and controls

28 lines (23 loc) · 912 Bytes
UPDATE products
SET unit_price = 1.41
WHERE product_name = 'A&W';
############################################# SCHEMA #############################################
define
product sub entity,
    key product_name,
    has unit_price;

product_name sub attribute, datatype string;
unit_price sub attribute, datatype double;

############################################# DATA #############################################
insert $p isa product, has product_name "Sprite", has unit_price 1.55;
insert $p isa product, has product_name "7 UP", has unit_price 1.68;
insert $p isa product, has product_name "A&W", has unit_price 2.41;

############################################# QUERY #############################################
match $p isa product, has product_name "A&W", has unit_price $up via $r;
delete $r;

match $p isa product, has product_name "A&W";
insert $p has unit_price 1.41;