Questions tagged as 'postgresql'

1
answer

How to convert day from date to date (without timestamp) [PostgreSQL]?

I have the value 2016001 symbolizing the first day of the year 2016, how do I get for example ANO/MES 2016263 ? Example: ENTRADA: $data = '2016001' SAÍDA: $anomes = '2016-01' If you could do the inverse of this SQL...
asked by 12.06.2017 / 16:01
1
answer

Searches for records that reference the same table

I have a table that it has a fk for itself. The sense of this is to set up a history of the previous records, so I have the column id and old_id, the old_id is fk for the id column. The problem is that I can not get more than one record, just on...
asked by 22.08.2017 / 19:31
2
answers

Is it possible to perform an Update in this way?

I have two tables, the Impressoras table is where the equipment data, such as model, assets, etc., is stored. And I have the Impressora Local table where the location where the printer is located is stored, the client where it is c...
asked by 10.07.2017 / 16:09
1
answer

How to perform a SQL command that takes several lines

I have a table where there are several records of supplies, now a column will be implemented in this table where a label will be implemented to facilitate finding these supplies in stock, I have already adjusted the table so that all new records...
asked by 21.07.2017 / 19:23
3
answers

Add the values of a count (*) in sql

I'm new to sql and I'm having trouble performing the sum total of values in a count , below the code: SELECT A.Pais, count(*) from Aeroportos A left join Estacoes E on A.Sigla = E.ICAO where E.ICAO IS NULL group by A.Pais order by Pais;...
asked by 17.10.2017 / 02:43
1
answer

Error saving data from a RadioGroup

I have a problem saving the information I select to a RadioGroup in the Database, after making the change that was suggested in this
asked by 11.01.2017 / 19:23
1
answer

PostgreSQL - Inserting data into tables linked by Foreign Key

Hello I have a data insertion problem in tables linked by foreign keys. I have read in some places that there is a "with" command that helps in these situations, but I did not quite understand how it is used. I would like to put together f...
asked by 11.01.2017 / 06:30
2
answers
1
answer

Select to check where a primary key is referenced

I have the following tables:
asked by 12.11.2016 / 14:15
1
answer

Improve search performance when there is no record

I have a database with 9551011 rows. It contains addresses from all over the country. When I make a query for a certain place, and that address exists in the database, I get a return in a maximum of 2 seconds. The problem is that this bank is...
asked by 01.09.2016 / 18:38