Relation:Modify relations

Unlike SQL, Relation is designed to anlayze relations, but you can also use it to manipulate relations.
You can read a CSV file, modify the relation in it and save it again as CSV file. Note however that you are working directly without safenet. Unless querying, modifying cannot be repeated.

Create relations

SQL Relation
CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
relation PersonID, LastName, FirstName, Adress, City
write "Persons.csv"
CREATE TABLE TestTable AS
SELECT customername, contactname
FROM customers
read "customers.csv"
project customername, contactname
write "TestTable.csv"

Add or remove columns

SQL Relation
ALTER TABLE Customers
ADD Email varchar(255)
read "Customers.csv"
extend Email ""
write "Customers.csv"
ALTER TABLE Customers
DROP COLUMN Email
read "Customers.csv"
project [there is no drop command, add all remaining columns here]
write "Customers.csv"

Insert

SQL Relation
INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country)
VALUES ('Cardinal', 'Tom B. Erichsen', 'Skagen 21', 'Stavanger', '4006', 'Norway')
read "Customers.csv"
insert "Cardinal", "Tom B. Erichsen", "Skagen 21", "Stavanger", 4006, "Norway"
write "Customers.csv"

Update

SQL Relation
UPDATE Customers
SET ContactName = 'Alfred Schmidt', City= 'Frankfurt'
WHERE CustomerID = 1
read "Customers.csv"
update ContactName = "Alfred Schmidt" where CustomerID = 1
update City= 'Frankfurt' where CustomerID = 1
write "Customers.csv"

Delete

SQL Relation
DELETE FROM Customers WHERE CustomerName='Alfreds Futterkiste'; read "Customers.csv"
select CustomerName !== "Alfreds Futterkiste"
write "Customers.csv"