How to perform Raw SQL queries on different schemas? #9491
-
Hello i am trying to run raw sql queries onto a particular schema as I currently have 10 database schemas. I can't seem to find online how to run a sql query on a particular schema. Example I have a schema for each site like example and anotherexample. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found the answer on HasuraHQ Discord: CREATE TABLE "commerce"."products" ( "commerce" is the name of the schema and products is the name of the table. To select a schema you would do something like this: SELECT * from "users"."user_details" SELECT * from "public"."articles" |
Beta Was this translation helpful? Give feedback.
Found the answer on HasuraHQ Discord:
CREATE TABLE "commerce"."products" (
id INT PRIMARY KEY,
name VARCHAR(255),
price DECIMAL(10, 2),
description TEXT
);
"commerce" is the name of the schema and products is the name of the table.
To select a schema you would do something like this:
SELECT * from "users"."user_details"
SELECT * from "public"."articles"