Questions tagged as 'sql'

1
answer

How to change the value of the joker in the Prepared Statement?

Suppose I have a query with prepare that looks like this: select senha from usuarios where id=? //or id2=?, array($id,$id2); (é só um exemplo). My intention is to change the ? to any other value that I choose within the array...
asked by 17.02.2014 / 17:55
3
answers

Get all the columns of all the tables that contain a text

I would like to find out what all the columns in the tables in a database are in a way that you can search for a word in those columns. Let's say I have a database that I do not know about the structure, but I want to search for a word in all...
asked by 29.05.2018 / 20:46
1
answer

How to find the name and address of the students and teachers of São Paulo

Hello, I have a question on the question my teacher went through to train. The database has 5 tables being: a alunos , professores and historico in the exercise asks to consult the name and address of the students and teacher...
asked by 13.11.2018 / 19:11
1
answer

How do I know if a column exists in a table in Oracle?

I'm trying to add a new column to a table in Oracle, and I want to know if it already exists or not. I have tried something like this: IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'minhaTabela'...
asked by 30.01.2018 / 14:22
3
answers

How to declare a cursor type variable in PL-SQL?

I have a course: Cursor Pessoa is Select nomeFuncionario From empresa; -- Variaveis para uso da rotina variavel How would the variable be?     
asked by 31.01.2018 / 21:08
1
answer

Is it possible to search a data in the database without knowing which table it is in?

I have banco de dados too large and it is impractical to build a SELECT * FROM for each table and find the data I need.    If it is a texto especifico ('with as parameter 23') I have already looked in all ways and not   I...
asked by 29.01.2018 / 19:36
1
answer

Select returns 2 rows per GROUP BY account

The code below returns the number of dialed and the number of answered, but when adding the CASE to bring me the number of faults it separates the line from the answered ones from the line of the defaulters, this all on account of grou...
asked by 11.05.2018 / 15:36
1
answer

SQL - Transform different values of a column into several columns with count in each of them

My question is how to separate different values of a column into several columns and give a count on each item according to the name in postgres, follow the example below How are you? --TIPO O.S.--Count----Nome 1009 || 1 || Lucas...
asked by 03.03.2018 / 13:50
3
answers

problem with select case

I'm doing select with case comparing different statuses of the same field and counting them in separate columns. The problem is that the first column gets NULL until the list of the second ends the count. Then this is reversed. My quer...
asked by 31.08.2018 / 14:03
1
answer

Decode function e (+)

Problem: Resolution:SELECTNOME,DECODE(COUNT(CODIGO_LIVRO),0,'NENHUM',COUNT(CODIGO_LIVRO))"NR LIVROS" FROM AUTORES A,LIVROS L WHERE A.CODIGO_AUTOR=L.CODIGO_AUTOR(+) GROUP BY NOME ORDER BY 1; Tables: You can not reply to this topic...
asked by 17.12.2017 / 19:05