Questions tagged as 'sql'

2
answers

How to separate a letter from a character in SQL?

I have a variable of type character varying (17) and need to separate one of the characters, for example the third letter, and use it to filter. SELECT * FROM fnord WHERE terceira(illuminati) = "a"     
asked by 02.08.2018 / 14:43
1
answer

Error in IF condition

I'm doing a program in PHP but I'm having a problem. I want it, when $ user_info is equal to Tiago Goncalves, show the user image. The truth is that it is shown on the website all 3 pictures. HTML <html lang="en"> <head>...
asked by 02.08.2018 / 19:55
1
answer

How to make a unique field for each foreign key?

I am studying mysql and I came across the following situation and would like to know if there is a solution structuring my tables to solve this. Assuming I have two tables; user (id, user, password) and annotations (id, title, text, userid). In...
asked by 06.06.2018 / 18:13
1
answer

Filtering data in mysql

I have a table called tb_codigos containing the following columns: cod , txt1 , txt2 I need to add the number of characters in the two columns txt1 and txt2 , in the example below the character size is 6, when I try to filter all the...
asked by 23.04.2018 / 19:34
2
answers

UPSERT or UPDATE-INSERT?

Through this question I felt the need to research and understand a little about the UPSERT . I was wondering what a blessed command this is? I never saw .. I found some information but it is still not clear to me because there is no "basi...
asked by 23.08.2018 / 13:16
1
answer

Limit records by number of replicates

I have a query as follows, and would like to filter by COUNT SELECT COUNT(1) AS QTD, Nome, Cpf FROM Funcionarios WHERE QTD >= 2 GORUP BY Nome, Cpf     
asked by 03.08.2018 / 15:39
2
answers

Prioritize row in sql queries

In a Results with 2 fields exactly alike, how to do that only show lines that the priority column is marked as 1 id | origem | destino | daia_inicio | data_fim | valor | prioridade 01 | Galeão | Barra | 01/01/2018 | 31/...
asked by 12.02.2018 / 16:10
3
answers

Send data to the database according to the select tag via PHP [closed]

I am making a form to send some data to the bank, to expedite a process, my question is the following, I have 5 systems that I need to update, so I made a select in html. Home I need to send each option of select to a differ...
asked by 06.11.2018 / 14:17
2
answers

SQL SERVER - Calculation

I have a question for setting up a scorecard and that I can not get out of it. I basically have two tables.    Table 1: CONTRACTS   Fields: Company ID, Contract ID, Product ID, Quantity       Table 2: RECEIPTS   Fields: Company ID, Rece...
asked by 24.08.2017 / 20:25
1
answer

How to solve SQLite auto increment gap?

I have a code that deletes a whole row of a database , but there is a problem because I get a hole getting an ID with no data (which I deleted) by this being autoincrement , does not delete the ID value. How do I solve the problem?    ...
asked by 19.07.2017 / 00:08