Questions tagged as 'sql'

1
answer

Save information about execution days

Good afternoon, everyone. I have an automation monitoring system that consumes a table that contains information about n registered automations, about 40 presently. I would however like to make a check on the days on which these automations will...
asked by 15.09.2018 / 17:51
1
answer

SQL Query to Group Records in MS-ACCESS

Hello, I would like a command in SQL for a query in an Access database. The structure of the table is: tbList Id | Nome | Genero | Endereco | Estado | ... The result you would like to group by state and count the number of gender (sex)...
asked by 19.09.2018 / 15:49
2
answers

Apply condition depending on value

In below, I need to use a condition only if the field is populated (line is commented out in script below). If not, this condition should not be part of query . Is there any way to do this via SQL ? SELECT DISTINCT SB2.B2_FILIAL,SB2.B2_C...
asked by 18.09.2018 / 14:48
1
answer

Problem with join and subqueries

I have an exercise to answer, however I do not get the complete solution, only partial ideas, the DBMS used is SQL Server. Considering the Customers, Orders, and Order Details tables, create an SQL query that brings the order ID, the order da...
asked by 19.09.2018 / 01:28
1
answer

How to add + x to each record returned in a SELECT [closed]

For example, in a select in the database, 5 records will be returned: SELECT * FROM esc_usuarios WHERE usu_indicador_codigo = '" . $_SESSION['codigo'] . "' AND usu_situacao = 'ativo'" Then I want to assign a value for each record,...
asked by 18.10.2018 / 23:03
1
answer

SQL Query with multiple arguments

I need to create an SQL query that may or may not have multiple arguments. Example: Pesquisa 1: "João Goiânia" Pesquisa 2: "Goiânia João" Pesquisa 3: "João Advogado Goiânia" The query should go through three fields: name, city, profession....
asked by 31.08.2018 / 21:29
1
answer

Doubt with procedure, passing table name as parameter in sql server

I would like to create a procedure where I will pass the table name and Table Id as parameters, how could I do this? I have my example of how I would like to do DECLARE @NomeTabela VARCHAR(50) = 'Region'; DECLARE @IdDaTabela INT = 1; select...
asked by 01.09.2018 / 16:24
1
answer

Delete all records from a database except a user

I have a database that I need to delete all the records that exist in it, except a user who is in the User table with a link to another table ( AspNetUsers ). I have already made a few attempts at SSMS , but I always encounter references and...
asked by 26.11.2018 / 16:50
1
answer

Select with two fields as FKs of the same table

I would like to know how to mount a select in Oracle to exit the names of teams that participated in a game, using the structure below: Hereisthecodeforcreatingthetable: Code for creating the table I think the output would be some...
asked by 28.11.2018 / 02:34
1
answer

Multi-tiered development and business rule

I work with a team developing an ERP and I am responsible for issuing reports, one of which executes a select in the bank that in tests took more than 2 hours running, which led to errors and a big doubt: who was processing all the inform...
asked by 26.11.2018 / 19:53