

It's time to update the town of Riverdale again, this time with a link to the library. A record link is quick to make in SurrealDB: if a field contains the record ID of one or more other records, that's a link! For our existing town:riverdale record, a simple UPDATE statement is all that is needed. Don't forget to put the library inside an array, because the town may have more libraries to add later.
If we had used a random ID instead of place:surreal_library, we would have first used SELECT VALUE id to get the record ID of the existing town and library, followed by a WHERE clause to filter. Let's practice this method too.
When working with random IDs like this, using LET to create a parameter is a great way to make the code readable. To set a parameter, use the LET keyword followed by $ and the name that you want to give it.
Setting a parameter also makes it available for reuse, which can be convenient.
By using either of these two ways, the library is now linked to the town! If we select from the town table, we can now see the library that we linked.
That output is a bit boring though, as the libraries only shows the record name for the library.
To make the output more interesting, we can add .name to libraries to directly access the place's name.
Or we can use .{} to select some fields from the linked libraries, such as name and floors.
A quick way to display all the fields of a linked record is by adding the FETCH keyword to the end.