Changing data in an existing Delta Lake table
In the previous section, we saw how new data can be written to a Delta Lake table. But transactions in Delta Lake are not only about new data – we may also need to update and delete data as well. In this section, we will find out how the data lake reacts to changes in existing data:
- To highlight the effect of changes to Delta Lake tables, we will work with a sample row in the
store_orders
table as follows:%sql SELECT * FROM store_orders WHERE order_number=5;
This results in the following output:
- Now, we will update this row and change the
sale_ price
value from98.41
to90.50
:%sql UPDATE store_orders SET sale_price=90.50 WHERE order_number=5;
- Check if the
sale_ price
value got updated in thestore_orders
table:%sql SELECT * FROM store_orders WHERE order_number=5;
This results in the following output: