Questions tagged as 'postgresql'

2
answers

Is it possible to use between to filter searches with a character type field?

For example, if I am to search the database for a table with the price of the products, I use it in my condition where: preco_produto between 10 and 550 but and for me to do the same type of search in a column of character type? Because when try...
asked by 15.10.2015 / 21:39
1
answer

Sql - Merge select - Create row if none exist

I want to join two SELECT , but I'm unsuccessful. It has the following tables: CREATE TABLE tb_producao ( cd_producao SERIAL, cd_setor integer, nr_quantidade numeric(12,2), ds_producao character varying(255) ); CREATE TABLE t...
asked by 14.10.2015 / 16:31
2
answers

Duplicate results when searching with POSTGRES

I am doing a search in the database where I perform some JOIN in different tables. In the SQL that inseir below I make a join with the commodity_category_table table where the product id must be present in it to return with which categories it i...
asked by 01.12.2015 / 14:39
1
answer

Error: table name specified more than once

I created a column included in the app table, it works to record the purchase date of the application and I will have to update the old records with the date of user creation. I have done a query to solve the problem, but postgreSQL has an error...
asked by 24.02.2015 / 20:35
2
answers

Group plots showing the value of the first and last plots

I have a parcel table with the following fields (among others): inscricao (Customer Registration), nrparcela (Portion Number), dt_vencimento (Expiration Date) and vlrparcela Plot). If the client has 10 parcels, the...
asked by 07.05.2014 / 16:45
1
answer

What SCRIPT in Postgres to list all Schemas?

I need to know which script I use to list all the Schemas in a Database? 1 Condition is listing all Schemas I have created and do not need Postgres Schemas I need this information to be able to automatically generate access permissions for users...
asked by 01.01.2019 / 16:24
2
answers

Insert in Postgres with Python is not working

I need to include data and a database of mine, but I can not and am not sure how to solve the problem. My code is as follows: import psycopg2 conn=psycopg2.connect("dbname='teste' user='postgres' host='localhost' password=''") c = conn.cur...
asked by 21.12.2018 / 17:42
1
answer

SELECT DISTINCT in column of type JSON in postgresql

I have a table that has 2 columns, id (int auto_increment) and resp (json). In this table I have duplicate values in the resp column, something like this: id | resp -------------------------------------------- 1 | {"nome": "Jonh Doe...
asked by 20.12.2018 / 12:30
1
answer

Inserting a JSON object into a JSON field in PostgreSQL with Python

Good morning, I have the following problem, I made a crawler and it receives the information, but at the time of formatting it in json format and inserting into the database it presents error. Follow the Code: valor_coleta = "3,5%"...
asked by 05.12.2018 / 14:21
1
answer

Pick up the start day and the end day of the specified week

Good afternoon, I'm returning from the database the number of the week in the year. ["data_hora"]=> string(16) "19/11/2018 15:26" ["num_semana"]=> string(2) "47" Where in week is the week number of the year that the date 19/11/2018 is...
asked by 21.11.2018 / 17:02