Questions tagged as 'sql'

2
answers

SQL Server - Check duplicate data in two concurrent fields

DBMS: SQL Server 2014; Problem: I need to know which records are duplicated, so that the verification is done in two simultaneous fields, ie if the field "CPF" with the value '83971465842' and the field 'MAT' with the value ' 001 'exists, in...
asked by 25.06.2014 / 22:39
2
answers

Show command executed when error occurs in SQL

Considering the following executed command BEGIN TRY -- Generate a divide-by-zero error. SELECT 1/0; END TRY BEGIN CATCH SELECT ERROR_NUMBER() AS ErrorNumber ,ERROR_SEVERITY() AS ErrorSeverity...
asked by 07.07.2016 / 19:22
3
answers

How to give a MySQL field line break in an HTML page

I need to save a value with a line break in the table For example, instead of saving: 0 anos, 3 dias Save: 0 Anos 3 Dias I tried the following process: INSERT INTO tabela (tempo) VALUES ('0 Anos\n3 Dias'); He even broke the cod...
asked by 10.04.2015 / 00:18
4
answers

Select with undefined number of conditions

It's the following, I have a search field, and I want to search in places other than what is registered, type like: tenis nike shox preto . I put in the search: tenis preto . If I use a like '%tenis preto%' description it will no...
asked by 16.10.2014 / 08:30
3
answers

Working with tags in MySQL

On a system I would like to categorize some users with tags. However there are groups of tags (for example, UF tag group, Interests). I'm trying to do a query where I can answer some questions like: I want all users in the state of SP or MG a...
asked by 14.01.2016 / 16:20
5
answers

What is the difference between comparison operators in Oracle?

In Oracle there are several operators to make comparisons of "different", such as: <> ¬= != ^= Example: Select * from tabel where nomeTabela <> 's'; Select * from tabel where nomeTabela != 's'; Select * from tabel where nomeTa...
asked by 30.10.2017 / 13:58
3
answers

How to do a select within a condition?

How can I do to create a script in SQL where a SELECT runs, and according to the result of a column of this first, a certain condition of another table? example: select * from tabela as t SE t.saldo = 0 entao WHERE t2.outracondicao =...
asked by 14.09.2018 / 13:19
3
answers

SQL Query Add duplicate value

When executing the SQL query I get the following result; However,Iwouldliketoreceivetheresultasfollows; SQL Query executed; SELECT CODIGO_BARRAS.barra, produtos_eventos.quantidade FROM PRODUTOS_EVENTOS,...
asked by 28.12.2018 / 14:15
1
answer

How to define pre-defined types in MySQL?

In the site I'm developing, I'll have, for example, a registration form where the user must define their gender in a combobox (male or female). The users table in the database will have all user fields as string , date , float...
asked by 16.08.2015 / 19:04
3
answers

How many days are left for a date [duplicate]

Does anyone have a query in sql server that returns how many days are missing for a date? I have the employee's date of admission, I need to know, how many days to complete 45 days, and how many days to complete 90 days.     
asked by 21.07.2017 / 19:53