I work with postgresql. CREATE TABLE "public".companyvotes ( userid uuid NOT NULL ,…
- User
I work with postgresql.
CREATE TABLE "public".company_votes ( user_id uuid NOT NULL , company_id uuid NOT NULL , grade integer NOT NULL , CONSTRAINT pk_company_votes PRIMARY KEY ( user_id, company_id ) );
CREATE TABLE "public".companies ( id uuid DEFAULT gen_random_uuid() NOT NULL , name text DEFAULT ''::text NOT NULL , handle text DEFAULT ''::text NOT NULL , CONSTRAINT pk_company PRIMARY KEY ( id ) ); CREATE TABLE "public".app_users ( id uuid DEFAULT gen_random_uuid() NOT NULL , full_name text DEFAULT ''::text NOT NULL , handle text DEFAULT ''::text NOT NULL , CONSTRAINT pk_app_user PRIMARY KEY ( id ) );
I need to insert new vote into compaby_votes, or update the existing one. If no user or company with such ids exist, i need to do nothing. how can I achieve this in single query
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.