0% found this document useful (0 votes)
20 views19 pages

Ollama Command Text

The document outlines the creation of a Postgres database schema for a system named 'siconv'. It includes the definition of multiple tables such as 'acoes', 'aerolevantamentos', 'analises', and others, along with their respective columns and data types. Additionally, it specifies the creation of sequences for auto-incrementing primary keys and the inclusion of various extensions like PostGIS.

Uploaded by

GAMES And stuff
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views19 pages

Ollama Command Text

The document outlines the creation of a Postgres database schema for a system named 'siconv'. It includes the definition of multiple tables such as 'acoes', 'aerolevantamentos', 'analises', and others, along with their respective columns and data types. Additionally, it specifies the creation of sequences for auto-incrementing primary keys and the inclusion of various extensions like PostGIS.

Uploaded by

GAMES And stuff
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

### Instructions:

Your task is to convert a question into a SQL query, given a Postgres database
schema.
Adhere to these rules:
- **Deliberately go through the question and database schema word by word** to
appropriately answer the question
- **Use Table Aliases** to prevent ambiguity. For example, 'SELECT table1.col1,
table2.col1 FROM table1 JOIN table2 ON table1.id = table2.id'.
- When creating a ratio, always cast the numerator as float
- When choosing a property for WHERE or JOIN statements, do not use primary
keys and/or IDs.

### Input:
Using the schema represented below:
CREATE SCHEMA siconv;
CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
CREATE EXTENSION IF NOT EXISTS postgis_raster WITH SCHEMA public;
CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;

CREATE TABLE public.acoes (


id bigint NOT NULL,
nome character varying(120) NOT NULL,
metodo character varying(200) NOT NULL,
ordem integer NOT NULL,
grupo character varying(80) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.acoes_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.acoes_perfis (


id bigint NOT NULL,
acao_id bigint NOT NULL,
perfil_id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.acoes_perfis_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.aerolevantamentos (


id bigint NOT NULL,
descricao character varying(100) NOT NULL,
camada character varying(60) NOT NULL,
data_inicial date NOT NULL,
data_final date NOT NULL,
gsd character varying(255) NOT NULL,
projecao character varying(60) NOT NULL,
url character varying(200) NOT NULL,
ativa boolean NOT NULL,
ordem integer NOT NULL,
geometria public.geometry(MultiPolygon,4326),
cidade_id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.aerolevantamentos_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.analises (


id bigint NOT NULL,
categoria_id bigint NOT NULL,
obra_id bigint NOT NULL,
analisavel_type character varying(255) NOT NULL,
analisavel_id bigint NOT NULL,
periodo character varying(20) NOT NULL,
status character varying(20) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.analises_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.arquivos (


id bigint NOT NULL,
fotografia_id bigint NOT NULL,
nome character varying(60) NOT NULL,
path character varying(150) NOT NULL,
data timestamp(0) without time zone NOT NULL,
modelo character varying(80) NOT NULL,
dispositivo character varying(80) NOT NULL,
software character varying(80) NOT NULL,
geometria public.geometry(Point,4326) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.arquivos_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.audits (


id bigint NOT NULL,
user_type character varying(255),
user_id bigint,
event character varying(255) NOT NULL,
auditable_type character varying(255) NOT NULL,
auditable_id bigint NOT NULL,
old_values text,
new_values text,
url text,
ip_address inet,
user_agent character varying(1023),
tags character varying(255),
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.audits_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.categorias (


id bigint NOT NULL,
descricao character varying(120) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.categorias_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.categorias_obras (


id bigint NOT NULL,
categoria_id bigint NOT NULL,
obra_id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.categorias_obras_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.categorias_questoes (


id bigint NOT NULL,
categoria_id bigint NOT NULL,
questao_id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.categorias_questoes_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.cidades (


id bigint NOT NULL,
codigo bigint NOT NULL,
nome character varying(100) NOT NULL,
uf character varying(2) NOT NULL,
area numeric(15,5) NOT NULL,
geometria public.geometry(MultiPolygon,4326) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.cidades_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.drones (


id bigint NOT NULL,
descricao character varying(100) NOT NULL,
camada character varying(60) NOT NULL,
data_inicial date NOT NULL,
data_final date NOT NULL,
url character varying(200) NOT NULL,
cidade_id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.drones_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.estados (


id bigint NOT NULL,
codigo integer NOT NULL,
nome character varying(60) NOT NULL,
sigla character varying(2) NOT NULL,
area numeric(15,5) NOT NULL,
geometria public.geometry(MultiPolygon,4326) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.estados_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.fontes (


id bigint NOT NULL,
descricao character varying(200) NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.fontes_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.fotografias (


id bigint NOT NULL,
cidade_id bigint NOT NULL,
titulo character varying(150) NOT NULL,
descricao text NOT NULL,
data_inicial date NOT NULL,
data_final date NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);
CREATE SEQUENCE public.fotografias_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.migrations (


id integer NOT NULL,
migration character varying(255) NOT NULL,
batch integer NOT NULL
);

CREATE SEQUENCE public.migrations_id_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.oauth_access_tokens (


id character varying(100) NOT NULL,
user_id bigint,
client_id bigint NOT NULL,
name character varying(255),
scopes text,
revoked boolean NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone,
expires_at timestamp(0) without time zone
);

CREATE TABLE public.oauth_auth_codes (


id character varying(100) NOT NULL,
user_id bigint NOT NULL,
client_id bigint NOT NULL,
scopes text,
revoked boolean NOT NULL,
expires_at timestamp(0) without time zone
);

CREATE TABLE public.oauth_clients (


id bigint NOT NULL,
user_id bigint,
name character varying(255) NOT NULL,
secret character varying(100),
provider character varying(255),
redirect text NOT NULL,
personal_access_client boolean NOT NULL,
password_client boolean NOT NULL,
revoked boolean NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.oauth_clients_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.oauth_personal_access_clients (


id bigint NOT NULL,
client_id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.oauth_personal_access_clients_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
CREATE TABLE public.oauth_refresh_tokens (
id character varying(100) NOT NULL,
access_token_id character varying(100) NOT NULL,
revoked boolean NOT NULL,
expires_at timestamp(0) without time zone
);

CREATE TABLE public.obras (


id bigint NOT NULL,
nome character varying(200) NOT NULL,
codigo character varying(60) NOT NULL,
localizacao text NOT NULL,
data_inicio date NOT NULL,
data_fim date NOT NULL,
geometria public.geometry(Geometry,4326) NOT NULL,
centroide public.geometry(Point,4326) NOT NULL,
revestimento character varying(200) NOT NULL,
valor numeric(10,2) NOT NULL,
extensao numeric(8,4) NOT NULL,
dimensao numeric(10,2) NOT NULL,
percentagem numeric(8,2) NOT NULL,
jazida boolean,
cidade_id bigint NOT NULL,
fonte_id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.obras_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.password_reset_tokens (


email character varying(255) NOT NULL,
token character varying(255) NOT NULL,
created_at timestamp(0) without time zone
);

CREATE TABLE public.perfis (


id bigint NOT NULL,
descricao character varying(80) NOT NULL,
peso integer NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.perfis_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.questoes (


id bigint NOT NULL,
camada character varying(20) NOT NULL,
tipo character varying(20) NOT NULL,
enunciado text NOT NULL,
peso integer NOT NULL,
situacao text NOT NULL,
periodo jsonb NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.questoes_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
CREATE TABLE public.respostas (
id bigint NOT NULL,
analise_id bigint NOT NULL,
questao_id bigint NOT NULL,
resposta jsonb,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.respostas_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.satelites (


id bigint NOT NULL,
descricao character varying(100) NOT NULL,
camada character varying(60) NOT NULL,
data_inicial date NOT NULL,
data_final date NOT NULL,
url character varying(200) NOT NULL,
cidade_id bigint NOT NULL,
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.satelites_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE public.usuarios (


id bigint NOT NULL,
nome character varying(120) NOT NULL,
email character varying(80) NOT NULL,
senha character varying(60) NOT NULL,
ativo boolean NOT NULL,
avatar character varying(15) NOT NULL,
ultimo_login timestamp(0) without time zone,
email_verified_at timestamp(0) without time zone,
perfil_id bigint NOT NULL,
remember_token character varying(100),
created_at timestamp(0) without time zone,
updated_at timestamp(0) without time zone
);

CREATE SEQUENCE public.usuarios_id_seq


START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

CREATE TABLE siconv.convenios (


nr_convenio bigint NOT NULL,
id_proposta bigint NOT NULL,
dia_inic_vigenc_conv date NOT NULL,
dia_fim_vigenc_conv date NOT NULL,
vl_global_conv numeric(15,5),
created_at timestamp(0) without time zone DEFAULT
CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp(0) without time zone DEFAULT
CURRENT_TIMESTAMP NOT NULL
);

CREATE TABLE siconv.propostas (


id_proposta bigint NOT NULL,
cod_munic_ibge bigint NOT NULL,
cod_orgao_sup bigint NOT NULL,
desc_orgao_sup character varying(200) NOT NULL,
objeto_proposta text NOT NULL,
created_at timestamp(0) without time zone DEFAULT
CURRENT_TIMESTAMP NOT NULL,
updated_at timestamp(0) without time zone DEFAULT
CURRENT_TIMESTAMP NOT NULL
);

ALTER TABLE ONLY public.acoes ALTER COLUMN id SET DEFAULT


nextval('public.acoes_id_seq'::regclass);
ALTER TABLE ONLY public.acoes_perfis ALTER COLUMN id SET DEFAULT
nextval('public.acoes_perfis_id_seq'::regclass);
ALTER TABLE ONLY public.aerolevantamentos ALTER COLUMN id SET
DEFAULT nextval('public.aerolevantamentos_id_seq'::regclass);
ALTER TABLE ONLY public.analises ALTER COLUMN id SET DEFAULT
nextval('public.analises_id_seq'::regclass);
ALTER TABLE ONLY public.arquivos ALTER COLUMN id SET DEFAULT
nextval('public.arquivos_id_seq'::regclass);
ALTER TABLE ONLY public.audits ALTER COLUMN id SET DEFAULT
nextval('public.audits_id_seq'::regclass);
ALTER TABLE ONLY public.categorias ALTER COLUMN id SET DEFAULT
nextval('public.categorias_id_seq'::regclass);
ALTER TABLE ONLY public.categorias_obras ALTER COLUMN id SET
DEFAULT nextval('public.categorias_obras_id_seq'::regclass);
ALTER TABLE ONLY public.categorias_questoes ALTER COLUMN id SET
DEFAULT nextval('public.categorias_questoes_id_seq'::regclass);
ALTER TABLE ONLY public.cidades ALTER COLUMN id SET DEFAULT
nextval('public.cidades_id_seq'::regclass);
ALTER TABLE ONLY public.drones ALTER COLUMN id SET DEFAULT
nextval('public.drones_id_seq'::regclass);
ALTER TABLE ONLY public.estados ALTER COLUMN id SET DEFAULT
nextval('public.estados_id_seq'::regclass);
ALTER TABLE ONLY public.fontes ALTER COLUMN id SET DEFAULT
nextval('public.fontes_id_seq'::regclass);
ALTER TABLE ONLY public.fotografias ALTER COLUMN id SET DEFAULT
nextval('public.fotografias_id_seq'::regclass);
ALTER TABLE ONLY public.migrations ALTER COLUMN id SET DEFAULT
nextval('public.migrations_id_seq'::regclass);
ALTER TABLE ONLY public.oauth_clients ALTER COLUMN id SET DEFAULT
nextval('public.oauth_clients_id_seq'::regclass);
ALTER TABLE ONLY public.oauth_personal_access_clients ALTER COLUMN id
SET DEFAULT
nextval('public.oauth_personal_access_clients_id_seq'::regclass);
ALTER TABLE ONLY public.obras ALTER COLUMN id SET DEFAULT
nextval('public.obras_id_seq'::regclass);
ALTER TABLE ONLY public.perfis ALTER COLUMN id SET DEFAULT
nextval('public.perfis_id_seq'::regclass);
ALTER TABLE ONLY public.questoes ALTER COLUMN id SET DEFAULT
nextval('public.questoes_id_seq'::regclass);
ALTER TABLE ONLY public.respostas ALTER COLUMN id SET DEFAULT
nextval('public.respostas_id_seq'::regclass);
ALTER TABLE ONLY public.satelites ALTER COLUMN id SET DEFAULT
nextval('public.satelites_id_seq'::regclass);
ALTER TABLE ONLY public.usuarios ALTER COLUMN id SET DEFAULT
nextval('public.usuarios_id_seq'::regclass);
ALTER TABLE ONLY public.acoes_perfis
ADD CONSTRAINT acoes_perfis_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.acoes
ADD CONSTRAINT acoes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.aerolevantamentos
ADD CONSTRAINT aerolevantamentos_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.analises
ADD CONSTRAINT analises_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.arquivos
ADD CONSTRAINT arquivos_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.audits
ADD CONSTRAINT audits_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.categorias_obras
ADD CONSTRAINT categorias_obras_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.categorias
ADD CONSTRAINT categorias_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.categorias_questoes
ADD CONSTRAINT categorias_questoes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.cidades
ADD CONSTRAINT cidades_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.drones
ADD CONSTRAINT drones_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.estados
ADD CONSTRAINT estados_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.fontes
ADD CONSTRAINT fontes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.fotografias
ADD CONSTRAINT fotografias_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.migrations
ADD CONSTRAINT migrations_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.oauth_access_tokens
ADD CONSTRAINT oauth_access_tokens_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.oauth_auth_codes
ADD CONSTRAINT oauth_auth_codes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.oauth_clients
ADD CONSTRAINT oauth_clients_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.oauth_personal_access_clients
ADD CONSTRAINT oauth_personal_access_clients_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.oauth_refresh_tokens
ADD CONSTRAINT oauth_refresh_tokens_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.obras
ADD CONSTRAINT obras_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.password_reset_tokens
ADD CONSTRAINT password_reset_tokens_pkey PRIMARY KEY (email);
ALTER TABLE ONLY public.perfis
ADD CONSTRAINT perfis_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.questoes
ADD CONSTRAINT questoes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.respostas
ADD CONSTRAINT respostas_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.satelites
ADD CONSTRAINT satelites_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.usuarios
ADD CONSTRAINT usuarios_email_unique UNIQUE (email);
ALTER TABLE ONLY public.usuarios
ADD CONSTRAINT usuarios_pkey PRIMARY KEY (id);
CREATE INDEX aerolevantamentos_geometria_index ON
public.aerolevantamentos USING gist (geometria);
CREATE INDEX analises_analisavel_type_analisavel_id_index ON
public.analises USING btree (analisavel_type, analisavel_id);
CREATE INDEX audits_auditable_type_auditable_id_index ON public.audits
USING btree (auditable_type, auditable_id);
CREATE INDEX audits_user_id_user_type_index ON public.audits USING btree
(user_id, user_type);
CREATE INDEX cidades_geometria_index ON public.cidades USING gist
(geometria);
CREATE INDEX estados_geometria_index ON public.estados USING gist
(geometria);
CREATE INDEX oauth_access_tokens_user_id_index ON
public.oauth_access_tokens USING btree (user_id);
CREATE INDEX oauth_auth_codes_user_id_index ON public.oauth_auth_codes
USING btree (user_id);
CREATE INDEX oauth_clients_user_id_index ON public.oauth_clients USING
btree (user_id);
CREATE INDEX oauth_refresh_tokens_access_token_id_index ON
public.oauth_refresh_tokens USING btree (access_token_id);
CREATE INDEX obras_geometria_index ON public.obras USING gist
(geometria);
ALTER TABLE ONLY public.acoes_perfis
ADD CONSTRAINT acoes_perfis_acao_id_foreign FOREIGN KEY (acao_id)
REFERENCES public.acoes(id);
ALTER TABLE ONLY public.acoes_perfis
ADD CONSTRAINT acoes_perfis_perfil_id_foreign FOREIGN KEY (perfil_id)
REFERENCES public.perfis(id);
ALTER TABLE ONLY public.aerolevantamentos
ADD CONSTRAINT aerolevantamentos_cidade_id_foreign FOREIGN KEY
(cidade_id) REFERENCES public.cidades(id);
ALTER TABLE ONLY public.analises
ADD CONSTRAINT analises_categoria_id_foreign FOREIGN KEY
(categoria_id) REFERENCES public.categorias(id);
ALTER TABLE ONLY public.analises
ADD CONSTRAINT analises_obra_id_foreign FOREIGN KEY (obra_id)
REFERENCES public.obras(id);
ALTER TABLE ONLY public.arquivos
ADD CONSTRAINT arquivos_fotografia_id_foreign FOREIGN KEY
(fotografia_id) REFERENCES public.fotografias(id);
ALTER TABLE ONLY public.categorias_obras
ADD CONSTRAINT categorias_obras_categoria_id_foreign FOREIGN KEY
(categoria_id) REFERENCES public.categorias(id);
ALTER TABLE ONLY public.categorias_obras
ADD CONSTRAINT categorias_obras_obra_id_foreign FOREIGN KEY
(obra_id) REFERENCES public.obras(id);
ALTER TABLE ONLY public.categorias_questoes
ADD CONSTRAINT categorias_questoes_categoria_id_foreign FOREIGN
KEY (categoria_id) REFERENCES public.categorias(id);
ALTER TABLE ONLY public.categorias_questoes
ADD CONSTRAINT categorias_questoes_questao_id_foreign FOREIGN KEY
(questao_id) REFERENCES public.questoes(id);
ALTER TABLE ONLY public.drones
ADD CONSTRAINT drones_cidade_id_foreign FOREIGN KEY (cidade_id)
REFERENCES public.cidades(id);
ALTER TABLE ONLY public.fotografias
ADD CONSTRAINT fotografias_cidade_id_foreign FOREIGN KEY (cidade_id)
REFERENCES public.cidades(id);
ALTER TABLE ONLY public.obras
ADD CONSTRAINT obras_cidade_id_foreign FOREIGN KEY (cidade_id)
REFERENCES public.cidades(id);
ALTER TABLE ONLY public.obras
ADD CONSTRAINT obras_fonte_id_foreign FOREIGN KEY (fonte_id)
REFERENCES public.fontes(id);
ALTER TABLE ONLY public.respostas
ADD CONSTRAINT respostas_analise_id_foreign FOREIGN KEY (analise_id)
REFERENCES public.analises(id);
ALTER TABLE ONLY public.respostas
ADD CONSTRAINT respostas_questao_id_foreign FOREIGN KEY
(questao_id) REFERENCES public.questoes(id);
ALTER TABLE ONLY public.satelites
ADD CONSTRAINT satelites_cidade_id_foreign FOREIGN KEY (cidade_id)
REFERENCES public.cidades(id);
ALTER TABLE ONLY public.usuarios
ADD CONSTRAINT usuarios_perfil_id_foreign FOREIGN KEY (perfil_id)
REFERENCES public.perfis(id);

Generate a SQL query that answers the question 'show me construction sites in
Fortaleza which started in 01/01/2020'.
### Response:
Based on your instructions, here is the SQL query I have generated to answer
the question:
sql

You might also like