Questions tagged as 'sql'

2
answers

How to select records in a table Auto referenced using Recursion?

In a scenario of areas where one area can be overseen by another one is represented in a tree structure as follows: Problem:TheneedtoselectÁrea(CBT-CubatãoIndustrialComplex)followtheHierarchy.(InthissituationalltheAreaslistedintheimage)Ther...
asked by 27.06.2017 / 16:14
2
answers

Why put COMMIT at the end of the script using the Firebird database

Why in the Firebird database everything I do, including create tables, is necessary at the end of the script to give a command COMMIT ?     
asked by 28.09.2016 / 02:44
1
answer

Query with random result

I have the following query, used in an internal routine, for distribution of items for separation in data collectors: Select distinct IP, USUARIO, DATA from PCN_ROMANEIO_ACESSO PRA Where pra.STATUS = 'OK' AND trunc(pra.DATA) = trunc(sysdate...
asked by 24.10.2016 / 13:12
1
answer

SQL - scope_identity () for INSERT SELECT

Is there something similar to scope_identity() to return me the ids created by giving insert based on select ? (% with more than one line at a time). NOTE: insert returns only one of scope_identity() ....
asked by 18.04.2017 / 03:27
1
answer

SQL / ORACLE Filter active records in month

I have a table that writes my records where one column writes the data_inicial and another column the data_final . I need to generate a report where the user searches all the records that were between the period of eg 03/03/2017...
asked by 10.04.2017 / 19:41
1
answer

How to return day of week and time formatted sql server 2008?

I need to make a query as follows, I have a table (script): 1 - Pick up the day of the week 2 - Get the server time in hh:mm format example: SELECT CASE DATEPART(DW, GETDATE()) WHEN 1 THEN 'DOMINGO' WHEN 2 THEN 'SE...
asked by 29.12.2015 / 03:47
1
answer

Working with a high processing load on a table

What are possible database modeling strategies in a scenario where you have a specific table that receives a gigantic load of statements of insert , update and delete , in addition to queries with high data processing,...
asked by 15.01.2016 / 20:17
3
answers

Execute a SELECT JOIN with condition for different tables

I'm doing a ticket system where I have the message table for every ticket . This message can be sent either by an administrator or by the user who opened ticket . With this, I have the problem of getting the user name, be i...
asked by 26.08.2016 / 15:25
1
answer

How to perform an arithmetic operation without sorting it in GROUP BY

Having the following SELECT querying a PivotTable from a subselect, I get the result of the query correctly however with records divided into the following example: cod_representante | ... | VALOR_TOTAL_MERCEARIA | VALOR_TOTAL_PC_MP 123...
asked by 01.12.2015 / 18:35
1
answer

C #, SQL, SQLITE How to return SQL statement from an action

I'm having a question in C # and in SQL commands, I'm currently using SQLite as the local database. In my application I make the insertion of records in the Database, so far so good, but I was wondering if there is any way to return the command...
asked by 16.06.2016 / 04:18