Questions tagged as 'sql'

2
answers

Revoke in TEMPORARY TABLE in PostgreSQL, is it possible?

Is it possible to give%% (Privilege Removal) so that users do not create temporary tables? The REVOKE I need to keep, however, I need to block CREATE TABLE . Is it possible?     
asked by 25.01.2018 / 12:22
1
answer

Table with Compound Key without repeating

How do I make a table with a compound key, but I can not repeat the combination of values. I want to store FRIENDS , using a syntax similar to this: tb_amizades id_usuario_um id_usuario_dois SELECT * FROM tb_amizades WHERE id_...
asked by 30.10.2017 / 15:10
1
answer

How to use LIKE with OR in Oracle?

I have the following table: CREATE TABLE DEPENDENTE ( IdDependente number(6), Matricula number(6), Nome char(50) NOT NULL, dtNascimento date, constraint pk_IdDependente PRIMARY KEY(IdDependente...
asked by 27.09.2017 / 17:55
2
answers

How to add foreign key with constraint and alter table in Oracle?

I have the following tables: Create table OS( nro_os number(4), data_os date , hora_os number(4) ); Create table cliente( cod_cliente number(4), nome_cliente varchar(12), endereco_cliente varchar(20), telefone_c...
asked by 29.09.2017 / 19:50
2
answers

Query with join

I have a problem in the query to generate a report. I made a JOIN of the ordering table (which will get the report) with the table of customers and products. Until then everything worked, but he hardly shows all the requests, only shows the firs...
asked by 17.11.2017 / 12:58
3
answers

Convert nvarchar field (50) into datetime table SQLSRV

I need to change a field in the SQL database table whose format is in nvarchar(50) and saved values in date format 07/09/2017 , containing NULL values too! Do I need to convert this direct field in the database to datetime...
asked by 07.09.2017 / 16:14
2
answers

Repeat previous rows when there is no record in SQL SERVER date

Friends, good afternoon! I came across a problem at work today, and I have not yet got a solution for it. As I do not have much experience in the database area I am having difficulty solving this problem, I would be very happy with a help, hi...
asked by 12.09.2017 / 22:17
1
answer

SQL returns two records for a field, how do you join them?

I have the following SQL code in DB2: SELECT p.nome_pessoa, a.dt_nascimento, alc.matricula, d.numero_documento, d.id_tdoc_pessoa FROM pessoas as p INNER JOIN alunos as a ON p.id_pessoa = a.id_pessoa INNER JOIN acad_alunos_cursos as alc ON alc....
asked by 22.12.2014 / 17:39
1
answer

Get data from a created column

Good night, I have a table with 4 fields and through them I make some calculations and create a new field to show these same results ... The problem is that later I want to go get those results and I do not know how to redeem them. / p> declare...
asked by 01.07.2017 / 03:10
2
answers

INNER JOIN in the same table

SELECT Agendamento.E3TimeStamp AS Data,Agendamento.Lote, Produtos_values.name as NomeProduto, Produtos_ValueData.TemplateID AS mp_produto FROM produtos_values inner join produtos_valuedata on produtos_values.id = produtos_valuedata.valueid,ag...
asked by 12.07.2017 / 16:36