Questions tagged as 'query'

1
answer

Help with ORDER BY clause by string

I have the following select command: select nome, case grau when 0 then 'QS' when 1 then 'CI' when 2 then 'CDC' when 3 then 'QM' end grau, case faixa when 0 then 'NÃO' when 1 then 'SIM' end faixa, mensalidade from socio order by grau, nome...
asked by 04.08.2018 / 05:55
1
answer

How to remove, insert or change a single character in a field in MySql?

I have the following table in MySql: Id | comida | preco 1 | batata | 325 2 | carne | 3.10 3 | speculoos | 3.00 I wanted to be able to change the points according to the needs below: If the food = potato , inser...
asked by 17.08.2018 / 17:56
2
answers

Convert SQL query to MongoDB

I have little (or no) knowledge in non-relational banks. I need to convert the query below (SQLite) into an equivalent query to be run in MongoDB. SELECT COUNT(*) FROM match_table WHERE (home_team_api_id=9991 AND home_team_goal > away_team_...
asked by 12.06.2018 / 19:12
1
answer

2 calls to the same table in SQLite (output different than expected)

Given the following 2 tables: CREATE TABLE IF NOT EXISTS sugestoes ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, texto VARCHAR(250), autor VARCHAR(250), itens VARCHAR(250), pontos INTEGER ); CREATE TABLE IF NOT...
asked by 02.06.2018 / 10:07
1
answer

How to do SQL query using like comparator and multiple values out of order

I looked for answers here in the community but found nothing specific. I have a page where I can search the names of clients previously registered in a MySQL database. I am currently using the following statements: PHP: $valor = str_replac...
asked by 01.06.2018 / 07:20
1
answer

How to shrink a large query - Postgresql [closed]

In Visual Studio, we have the possibility to shrink a large code, that is, visually decrease the size, as a way to make reading easier, for example: #region Seu código aqui... #endregion I would like to do the same in a query within my PG...
asked by 21.05.2018 / 18:24
1
answer

Concatenate varchar2 PLSQL

I have 2 tables with relationship 1 to many and I need to concatenate all values of column Nome of table 2 in only one column of select. Eg: In the example, the return of what I need would be Maria, João, José No...
asked by 14.06.2018 / 14:09
1
answer

Get record with SQL JDBC specifications

Hello, good afternoon. I'm having to develop a Java system with MySql. It's simple, just part of the backend, but I'm pushy and had not run querys with java before hehe. The system is the following, the basics: I have a database with a table...
asked by 10.05.2018 / 18:40
1
answer

Where to query using multiple properties of a list

I have the following scenario public Teste[] GetTestes(List<TesteDTO> testeDTOs){ IQueryble<Teste> query = GetAll<Teste>(); //where ... } public class Teste() { public int Prop1{ get; set;} public int P...
asked by 03.05.2018 / 20:57
1
answer

PostgreSQL query bringing more results than expected

Hello, I have a situation in a system where I need to find out which student enrollments are related to a tutor in a class. The tables I have are: matricula containing foreign key with student (mat_aln_id) and with class (mat_tur_...
asked by 10.04.2018 / 15:38