How to remove a relation in surrealdb

Viewed 58
RELATE (
  SELECT * from user where username = 'user_male'
)->interested_in->gender:female;

I used the above RELATE statement to specify that the user_male user is interested in women.

I can't figure out how to UNRELATE this user to that gender; or for example to SELECT all users that are interested in women

1 Answers

The edge interested_in becomes its own table from which you can delete rows with the DELETE statement.

To "unrelate" the relation, we only need to delete every entry from interested_in where in.username is 'user_male and where out is gender:female.

DELETE interested_in WHERE in.username = 'user_male' AND out = 'gender:female';
Related