The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
changed JSON Guide to use Books model
Mark Burggraf878eb6bcd8ab
diff --git a/web/docs/guides/database/json.mdx b/web/docs/guides/database/json.mdxindex 2c23b84d56a..e7a93455cb9 100644--- a/web/docs/guides/database/json.mdx+++ b/web/docs/guides/database/json.mdx@@ -22,23 +22,11 @@ From: [PostgreSQL JSON types](https://www.postgresql.org/docs/12/datatype-json.h### Create a table with a JSON column.<Tabs-defaultValue="Data"+defaultValue="SQL"values={[- {label: 'Data', value: 'Data'},{label: 'SQL', value: 'SQL'},{label: 'UI', value: 'UI'},]}>-<TabItem value="Data">--| id | title | author | metadata |-| -- | ----------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------- |-| 1 | The Poky Little Puppy | Janette Sebring Lowrey | {"ages":[3,6],"price":5.95,"description":"Puppy is slower than other, bigger animals."} |-| 2 | The Tale of Peter Rabbit | Beatrix Potter | {"ages":[2,5],"price":4.49,"description":"Rabbit eats some vegetables."} |-| 3 | Tootle | Gertrude Crampton | {"ages":[2,5],"price":3.99,"description":"Little toy train has big dreams."} |-| 4 | Green Eggs and Ham | Dr. Seuss | {"ages":[4,8],"price":7.49,"description":"Sam has changing food preferences and eats unusally colored food."} |-| 5 | Harry Potter and the Goblet of Fire | J.K. Rowling | {"ages":[10,99],"price":24.95,"description":"Fourth year of school starts, big drama ensues."} |--</TabItem><TabItem value="SQL">```sql@@ -79,11 +67,11 @@ CREATE TABLE books (### Insert data into the table.<Tabs-defaultValue="UI"+defaultValue="Data"values={[{label: 'Data', value: 'Data'},- {label: 'UI', value: 'UI'},{label: 'SQL', value: 'SQL'},+ {label: 'UI', value: 'UI'},{label: 'JS', value: 'JavaScript'},]}><TabItem value="Data">@@ -96,6 +84,28 @@ values={[| 4 | Green Eggs and Ham | Dr. Seuss | {"ages":[4,8],"price":7.49,"description":"Sam has changing food preferences and eats unusally colored food."} || 5 | Harry Potter and the Goblet of Fire | J.K. Rowling | {"ages":[10,99],"price":24.95,"description":"Fourth year of school starts, big drama ensues."} |+</TabItem>+<TabItem value="SQL">++```sql+insert into books (title, author, metadata) values+('The Poky Little Puppy',+ 'Janette Sebring Lowrey',+ '{"description":"Puppy is slower than other, bigger animals.","price":5.95,"ages":[3,6]}'),+('The Tale of Peter Rabbit',+ 'Beatrix Potter',+ '{"description":"Rabbit eats some vegetables.","price":4.49,"ages":[2,5]}'),+('Tootle',+ 'Gertrude Crampton',+ '{"description":"Little toy train has big dreams.","price":3.99,"ages":[2,5]}'),+('Green Eggs and Ham',+ 'Dr. Seuss',+ '{"description":"Sam has changing food preferences and eats unusally colored food.","price":7.49,"ages":[4,8]}'),+('Harry Potter and the Goblet of Fire',+ 'J.K. Rowling',+ '{"description":"Fourth year of school starts, big drama ensues.","price":24.95,"ages":[10,99]}');+```+</TabItem><TabItem value="UI">@@ -129,29 +139,6 @@ values={[- click `Save````-</TabItem>--<TabItem value="SQL">--```sql-insert into books (title, author, metadata) values-('The Poky Little Puppy',- 'Janette Sebring Lowrey',- '{"description":"Puppy is slower than other, bigger animals.","price":5.95,"ages":[3,6]}'),-('The Tale of Peter Rabbit',- 'Beatrix Potter',- '{"description":"Rabbit eats some vegetables.","price":4.49,"ages":[2,5]}'),-('Tootle',- 'Gertrude Crampton',- '{"description":"Little toy train has big dreams.","price":3.99,"ages":[2,5]}'),-('Green Eggs and Ham',- 'Dr. Seuss',- '{"description":"Sam has changing food preferences and eats unusally colored food.","price":7.49,"ages":[4,8]}'),-('Harry Potter and the Goblet of Fire',- 'J.K. Rowling',- '{"description":"Fourth year of school starts, big drama ensues.","price":24.95,"ages":[10,99]}');-```-</TabItem><TabItem value="JavaScript">@@ -190,28 +177,15 @@ const { data, error } = await supabase</TabItem></Tabs>--### View the data.<TabsdefaultValue="SQL"values={[- {label: 'Data', value: 'Data'},{label: 'SQL', value: 'SQL'},{label: 'JS', value: 'JavaScript'},+ {label: 'Data', value: 'Data'},]}>-<TabItem value="Data">--| id | title | author | metadata |-| -- | ----------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------- |-| 1 | The Poky Little Puppy | Janette Sebring Lowrey | {"ages":[3,6],"price":5.95,"description":"Puppy is slower than other, bigger animals."} |-| 2 | The Tale of Peter Rabbit | Beatrix Potter | {"ages":[2,5],"price":4.49,"description":"Rabbit eats some vegetables."} |-| 3 | Tootle | Gertrude Crampton | {"ages":[2,5],"price":3.99,"description":"Little toy train has big dreams."} |-| 4 | Green Eggs and Ham | Dr. Seuss | {"ages":[4,8],"price":7.49,"description":"Sam has changing food preferences and eats unusally colored food."} |-| 5 | Harry Potter and the Goblet of Fire | J.K. Rowling | {"ages":[10,99],"price":24.95,"description":"Fourth year of school starts, big drama ensues."} |--</TabItem><TabItem value="SQL">```sql@@ -228,6 +202,17 @@ const { data, error } = await supabaseconsole.log(JSON.stringify(data, null, 2));```+</TabItem>+<TabItem value="Data">++| id | title | author | metadata |+| -- | ----------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------- |+| 1 | The Poky Little Puppy | Janette Sebring Lowrey | {"ages":[3,6],"price":5.95,"description":"Puppy is slower than other, bigger animals."} |+| 2 | The Tale of Peter Rabbit | Beatrix Potter | {"ages":[2,5],"price":4.49,"description":"Rabbit eats some vegetables."} |+| 3 | Tootle | Gertrude Crampton | {"ages":[2,5],"price":3.99,"description":"Little toy train has big dreams."} |+| 4 | Green Eggs and Ham | Dr. Seuss | {"ages":[4,8],"price":7.49,"description":"Sam has changing food preferences and eats unusally colored food."} |+| 5 | Harry Potter and the Goblet of Fire | J.K. Rowling | {"ages":[10,99],"price":24.95,"description":"Fourth year of school starts, big drama ensues."} |+</TabItem></Tabs>