Questions tagged as 'sql'

3
answers

How do I know how many days the current month has?

How to know how many days the current MySQL month has, example: setembro = 30dias Reason: I have a goal: exemplo: 1.000,000 I need to get the value of the goal and divide by the number of days it has in the current month t...
asked by 21.09.2016 / 15:46
1
answer

SQL: How to count values in different columns

I would like to know how to count values in different columns. Generic example: ID - COLUNA1 - COLUNA2 1 - foo - Bar 2 - - Foo 3 - Qux - Bar 4 - Bar - I expect as a result count - value 2 - Foo 3 - Bar 1...
asked by 11.01.2016 / 11:09
1
answer

Adding data from a column

   id .. product ... value ... sales_id ... total value       01 .. Pen .... 2.00 .... 1 .......... 30.00       02 .. Rubber. 4.00 .... 2 ........... 25.50       03..Lapis ...... 5.00 .... 1 ........... 10.00       04 .. Pointer 9.00 ... 1 ....
asked by 05.01.2016 / 19:07
1
answer

What is the difference between the new JOIN operator and the previous ones?

I was looking at some examples of SQL in Oracle, and I noticed that it's only possible to do JOIN . Example SELECT T1.*, T2.desc FROM table1 T1 JOIN table2 T2 ON T2.id = T1.id_table2 Question What is the differe...
asked by 30.03.2017 / 14:07
3
answers

OFFSET next to COUNT (*) returns nothing?

When I make an inquiry this way the data is returned correctly (Currently 2 rows): SELECT * FROM noticias ORDER BY data_noticia DESC LIMIT 30 OFFSET 2 But I need to know how many rows this query returns me so intuitively it would look like...
asked by 06.09.2018 / 23:28
2
answers

Select with expression "other than" with two conditions

I would like to know if there is any way to make a select using a where for a field with a parameter other than < > , with two or more items. To facilitate following example: select * from TAB_DESPESAS where cd_ite...
asked by 31.07.2017 / 22:58
2
answers

Convert a positive decimal number, negative

I have the following query : Valor1 = '200.000,00'; select Valor1 from TB1 Is there a function that converts a positive number to negative?     
asked by 18.12.2015 / 10:56
2
answers

Can you tell when a record has been added to the bank?

I would like to know the time a record was added to the bank. I'll use this information to show the time a contact was added to my calendar.     
asked by 03.12.2015 / 04:36
2
answers

How to damage a website using XSS / SQL injection?

I'm not a hacker, but I know some techniques. I'm training security and I was really thoughtful about it. Every time I inject a script, it is a alert() , nothing dangerous for the host (for example). I do not have a website, there is no wa...
asked by 21.06.2014 / 05:06
4
answers

Is it possible to reference a column other than a primary key in another table?

For example, I want to reference the id_2 of Table 1 in Table 2, I know I can do with primary keys but with other columns I do not know if it is possible. Table 1: id (primary key of table 1), id_2, name Table 2: table_id2 (primary key of...
asked by 07.05.2014 / 16:20