Questions tagged as 'sql'

2
answers

Difficulty with SQL query creation

I'm creating a view with the following query: select COD_PESSOA as ra, NOM_PESSOA as nome, COD_PESSOA_PAI as pai, COD_PESSOA_MAE as mae, from PESSOA This query returns a result like this: ra nome pai ma...
asked by 10.11.2015 / 16:54
1
answer

PostgreSQL compilation error

Someone could tell me if there is an error in the query below: select name, cast(Extract(day from payday) as int) as 'day' from loan; I can not find the reason for having a compile error in the URI.     
asked by 05.11.2018 / 01:33
1
answer

PL / SQL procedure calls

Studying PL / SQL I came across the following code: CREATE PROCEDURE incluir_segmercado(p_id IN NUMBER , p_descricao IN VARCHAR2) IS BEGIN INSERT INTO segmercado values(p_id, UPPER(p_descricao...
asked by 13.11.2018 / 02:27
1
answer

PostGreSQL compilation error - Error

I'm trying to run this query in postgresql but it gives compilation error: select can.name as 'name', ((sco.math 2) + (sco.specific1 3) + (sco.project_plan * 5)) / 10) the "avg" from candidate can join score sco on can.id = sco.candidate_id o...
asked by 05.11.2018 / 21:07
1
answer

Convert Integer to Decimal in SQL

I have numbers in the database that are in full format. Ex: 12345 I want to convert it to the price format, in Reais. Ex: 12.345,00     
asked by 05.02.2015 / 19:51
2
answers

SQL Query - put result on a row only

SELECT pga.Titulo, e.Codigo FROM Qualidade_Diagrama_Processo_Grupo_Acao pga JOIN Qualidade_Diagrama_Acao_Entidade ae on (ae.Id_Proc_Grupo_Acao = pga.Id) JOIN Qualidade_Diagrama_Entidade e on (e.Id = ae.Id_Entidade) WHERE ae.Id_Pro...
asked by 04.07.2018 / 14:38
2
answers

Query of non-similar records

I have a table where I make the exchange data of some traders, For example, prof A has in common the exchange with prof F, so F has with A as well. But in the barter report I would not want you to show F with A, only A with F, because the inform...
asked by 25.06.2018 / 17:31
2
answers

Delete triggers per query

Inquiry To query all triggers of a database, use: SELECT * FROM sys.triggers Failed attempt I've tried delete all or some of triggers contained in the result: DELETE FROM sys.triggers or DELETE FROM sys.triggers W...
asked by 05.09.2018 / 18:36
1
answer

First and Last record including night

I'm having the following problem I have the data this way: codigo data_hora nome_ajudante -------+----------------+-------------- 1000004 2018-08-22 11:11 Carlos Eduardo 1000004 2018-08-22 11:43 Carlos Eduardo 1000004 2018-08-22 11:48...
asked by 28.08.2018 / 22:57
1
answer

Is there a way to retrieve data from a MySQL database?

I gave a delete in some files of the table, have some way to recover? I heard about flashback, but for the little I researched it is only for oracle.     
asked by 16.10.2014 / 22:54