Questions tagged as 'postgresql'

2
answers

How do I get the names of all PostgreSQL database tables?

How to get the names of all PostgreSQL database tables? How to get the attributes (code, name, etc ...) of a given table in the PostgreSQL database?     
asked by 07.02.2017 / 19:20
2
answers

Syntax difference between database

What is the difference, in the syntax, of the following databases, for a simple query, of type: SELECT * FROM tabela WHERE id = '1' ORDER BY nome GROUP BY nome LIMIT 1 Or, what do they differ in syntax in general? Or is it all the same?...
asked by 05.11.2017 / 04:07
1
answer

md5 Encryption PostgreSQL

I am creating a table using PostgreSql and in it there will be a password field with MD5 encryption. How would the syntax be in it? Because I have more contact with MySQL than PostgreSQL.     
asked by 04.11.2018 / 21:59
3
answers

Postgres SQLSTATE [42725]: Ambiguous function

I'm trying to run the following update using Postgres but I'm running into the following message. Does anyone know a way to solve?    "SQLSTATE [42725]: Ambiguous function: 7 ERROR: Operator is not unique:   unknown - unknown " UPDATE produ...
asked by 17.09.2015 / 20:39
2
answers

How to make a select from a Night time period (6:00 pm to 6:00 p.m.)

Description: Count how many times the action occurred in the night time considering the time from 6:00 p.m. to 6:00 p.m. There is a better way to do such a select without having to use or to compare the periods? select count(*) as contado...
asked by 03.03.2015 / 15:14
1
answer

How to change location in PostgreSQL

My database has locale en_US.UTF-8 , I need to change it to pt_BR.UTF-8 for query sorting. How can I do this with only phpPgAdmin ?     
asked by 30.06.2015 / 20:04
2
answers

SQL query with array type in PostgreSQL

How to filter this field of type array in PostgreSQL? I have a X table with a Y field of type character varying[] with two records: {'meeting','lunch','training','presentation'} {'breakfast','consulting', 'meeting'}...
asked by 12.08.2015 / 16:07
2
answers

Get the average between dates of type timestamp

I have 3 dates: 2016-08-17 12:29:01 2016-08-17 12:34:13 2016-08-17 12:39:26 And I would like to get the average time between them. If there are more than 60 seconds, then in minutes, and the same for hours.     
asked by 18.08.2016 / 19:50
2
answers

Return default value if there is no record

I have the following sql command from select: SELECT public.controleimpressoes.codigo, public.impressoras.patrimonio, public.impressoramodelo.modelo, public.impressoralocal.descricao, (select SUBSTR((to_char(data - interv...
asked by 08.03.2018 / 18:58
1
answer

In PostgreSQL, which field to use for percentage?

In the table I am creating, I will have a column that will indicate the discount percentage, for example, "for a certain agreement I will have a 20% discount, for another agreement I will have a 50% discount", and I will need to use it in calcul...
asked by 27.02.2015 / 15:36