Questions tagged as 'sql'

2
answers

MD5 is good enough?

I'm working on a legacy system, which has a database with some 5 years of cumulative records without any normalization. Among other things, its purpose is to allow users to write and post posts in the same style of Twitter, but without the limit...
asked by 25.06.2016 / 14:01
2
answers

Join repeats records? [closed]

I have tables in the database that relate. A (t.a) has four rows that relate to the other four rows of (t.b) The query is performed by means of a (user.id) that exists in both tables. Does the problem occur in the return of the query that rep...
asked by 27.06.2016 / 17:01
3
answers

Make a select with count and add

I need to perform a select, which swallows the total number of students enrolled per class and company, only when it is company ('X' e 'Y') add the total amount of them, ('D' e 'F') also add up the total amount of them, for company...
asked by 05.10.2016 / 15:08
1
answer

Capture value of last INSERT

I am creating a news system where the user has the option to register the news and put the original link where the news was generated, so far so good, the problem is that I want the user to have the option to register the news with the news link...
asked by 02.05.2016 / 20:29
1
answer

Check if date is between a period

In my table, I have two columns, DT_INICIO and DT_FIM , it would be an Absence table. Let's say that an employee is absent in DT_INICIO From (25/03/2016) to DT_FIM (3/27/2016), I need to make an appointment on 03/26...
asked by 31.03.2016 / 20:14
1
answer

Table Analysis with Execution Log

I have a table in Oracle 11g with the following structure: CREATE TABLE USER.LOG_EXECUCAO ( ID NUMBER, DATA DATE, QTD_REGISTROS_INSERIDOS NUMBER, TEMPO_EXECUCAO VARCHAR2(50 BYTE) )...
asked by 04.04.2016 / 14:43
1
answer

Query id most often repeated

I have two tables, one user and one visitas . In the visitas table I keep the ID of the user who was visited and who visited. How to make a query where I leave the users in order of more number of visits? I do not keep the...
asked by 28.03.2016 / 17:17
2
answers

Checking date within a range in SQL

I need to check in my SELECT whether the e.DataTrm field is between 30 and 90 days from today's date. How to make condition in CASE? SELECT e.NmrCnt AS [Contrato] ,e.NmrSerie AS [Serie] ,e.DataAfr AS [Data Aferiçã...
asked by 21.09.2016 / 20:49
2
answers

Compare data sql

I need to compare date at a certain time interval. I need to get the DAT_REPOT_REALZ field and check the dates between TODAY and seven days ago. I also need to count the number of V (visitor) and the number of L (leader) and M (participan...
asked by 12.02.2016 / 11:40
1
answer

Calculate average with result of Pivot

I have a query that returns me the student grades in certain tests. The amount of test can vary. I use the Pivot command to transform the test names into columns and thus organize test / note, as shown in the following image: Where"SENEM_01"...
asked by 29.06.2016 / 16:32