Skip to content

Inline SQL Editor component #2903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions content/postgresql/postgresql-tutorial/postgresql-uuid.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ Output:
(1 row)
```

You can try the `gen_random_uuid()` function using the interactive SQL editor below. Running the query will provision a Postgres database on Neon, and you can execute the query to see the output.

<SqlEditor
defaultQuery={`SELECT gen_random_uuid();`}
/>

<SqlEditor
defaultQuery={`INSERT INTO users (name, email) VALUES ('John Doe', '[email protected]');\nSELECT * FROM users;`}
setupQuery="CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY, name VARCHAR(255), email VARCHAR(255));"
/>

## Creating a table with a UUID column

We will [create a table](postgresql-create-table) whose [primary key](postgresql-primary-key) is a UUID data type. Additionally, the values of the primary key column will be generated automatically using the `gen_random_uuid()` function.
Expand Down
Loading
Loading