Questions tagged as 'sql'

1
answer

Query in MySQL does not sort correctly

I have a game table called game , a game platform table called plataformas and a table that makes the N-to-N relationship between the two calls game_plataforma . I have a query that has to search for a gaming platform, but...
asked by 08.01.2017 / 00:44
1
answer

Formula within a Field

In a field I have the value of a formula ( (B/2)+ C ), with the value B and C coming from other fields, how can I change the values of the letters by their actual values and calculate the formula? I only need one north of how to do th...
asked by 06.12.2017 / 14:41
1
answer

What are the differences between the HASH and BTREE algorithms used in an index?

I realized that I can create two types of indexes for a determining field in HeidiSQL, which use the algorithm HASH or BTREE , see below: See the CREATE code for a sample table for the illustration: CREATE TABLE 'pessoa'...
asked by 25.11.2017 / 18:50
2
answers

mysqli_real_escape_string Prevents SQL Injection?

According to the documentation, the function: Exits special characters in a string for use in a SQL statement, taking into account the current character set of the connection. Then: Is there a possibility of SQL Injection even when us...
asked by 17.11.2017 / 13:54
1
answer

What is the logic behind the trunc function?

What does trunc do right and what other utilities can this example take?     
asked by 14.12.2017 / 15:23
2
answers

For / Foreach Sql Server For Each Different Data of a Column

I need to execute a SQL command to give an Update to a table, The intention of this update would be to update a column with a sequential number per company, Ex: I have a table Sale in this table I have the column CompanyId for each company I i...
asked by 30.12.2017 / 00:57
2
answers

How to get data from the previous row in SQL?

How to create a column with the value of the previous row in another column? Here's an example, I have the time column and I want to create the column time_lag : Tabela inicial: id | title | time | domain 32 title1 12:30 do...
asked by 07.11.2016 / 13:20
2
answers

SQL Simple Query

I'm starting with Database, and I came across a situation that I just do not understand. I wanted to get the name of the student and the name of the subject that are in table 3 in the case " TbMateriasAluno " I used this Select comma...
asked by 19.08.2016 / 16:14
2
answers

Search for the next 7 days in SQL [duplicate]

I have the following SQL SELECT 'age'.*, 'inte'.'int_nome', 'inte'.'int_cod_unidade', 'set_uni'.'uni_titulo' as set_unidade, 'set_cur'.'cur_titulo' as set_curso, 'set_sta'.'set_setor' as set_status, 'con'.'con_nome' as agendado_por, 'ope'.'c...
asked by 30.08.2016 / 15:42
1
answer

Select with two tables and one condition in each with MYSQL [closed]

I have two tables that do not relate. One is of reports, where it contains the name of teachers and their respective subject, the other table is called login, which contains credentials of each teacher, their privilege and also their respective...
asked by 26.09.2016 / 14:56