Questions tagged as 'sql'

3
answers

What is the difference between a View and a Stored Procedure in SQL? [duplicate]

I have encountered Views in SQL and also with stored procedures. I would like to understand better, what is the difference between a view and a stored procedure and what are its purposes? Would it be possible to provide a practical case for...
asked by 27.08.2018 / 15:46
2
answers

Change Varchar field to Date MySQL

I need to fix a table that was built in the wrong way, the field that would be to store the date was created as varchar . With this structure I can not select a certain period, since varchar are sorted from left to right in...
asked by 23.06.2016 / 17:52
2
answers

Check if it already exists in the table before entering record

I need to include a record in a table, however before inclusion to avoid duplication it is necessary to do a check. As I have a ID column with property AUTO INCREMENT , I can not use INSERT IGNORE INTO . Table CREATE T...
asked by 08.12.2016 / 16:46
3
answers

Column 'column name' in where clause is ambiguous

I am trying to mount a left join where I want the results of a certain code. My SQL is: $resultado = mysql_query("SELECT CA.DAT_EHORA_EVENT, CA.TXT_NOMEX_EVENT, CA.MEM_DESCR_EVENT FROM tbl_CLIENTES C LEFT JOIN tbl_CLIENTES_AGENDA CA ON...
asked by 24.06.2015 / 21:31
3
answers

Help with select

I'm using the command select below: select f.no_equipe, h.no_pessoa_fisica, a.no_cidadao, d.dt_ficha from tb_cds_cad_individual a, tb_cds_atend_individual b, rl_cds_atend_individual_ciap c, tb_cds_ficha_atend_individual d, tb_equipe f,...
asked by 06.09.2017 / 19:41
1
answer

How to change null field to return nothing?

In a query has many fields unfilled, I would like to change the null being printed so that nothing appears in the print.     
asked by 18.05.2016 / 21:41
3
answers

How to group by weeks using sql?

I have the following problem. I have several requests, and I want to group them for weeks. I have already seen several examples, but almost none helped me, I would like to know if there is a function that when placed in Group by the result of th...
asked by 07.03.2016 / 13:04
3
answers

How to show a column, but if it has null show another sql

How to show a column, but if it has null show another sql such as a table named Task. | id | nome | nome resumido | +-----+----------+----------------+ | 1 | nome 1 | 1 | | 2 | nome 2 | 2 | | 3 | nome...
asked by 30.05.2018 / 16:36
2
answers

How to get the number of columns in a temporary table

How can I get the number of columns in a given temporary table in the sql server ?     
asked by 27.04.2018 / 15:27
3
answers

Replace value null

I would like that when I came null in my select replace with 1900 , follow select: SELECT (SELECT TOP 1 tabela1.data FROM tabela1 tabela1 WHERE tabela1.id = tabela2.id) as data FROM tabela2 tabela2     
asked by 26.01.2018 / 13:06