Questions tagged as 'sql'

2
answers

Avg per hour MySQL

Hello, I would like to know how to return only the hourly averages of a table as below: id | valor | timestamp | 1 | 5.4 | 2017-4-20 18:00 | 2 | 3 | 2017-4-20 18:01 | 3 | 2.8 | 2017-4-20 18:40 | 4 | 2 | 2017-4-20 19:0...
asked by 21.04.2017 / 23:45
2
answers

sql inserts the wrong datetime into table [closed]

I'm using microsoft sql manager, and was trying to insert a date into my table, the problem is that it's inserting the wrong date, I make the following command for the manager's table INSERT INTO tblCliente /*minha tabela que eu criei*/ VALUES...
asked by 21.04.2017 / 22:08
1
answer

Is it possible to use the same name of a column as a parameter name in a cursor?

I have the following cursor: -- CÓDIGO OMITIDO DECLARE CURSOR CUR_AULAS(IDTURMA NUMBER) IS SELECT ID, IDCLIENTE FROM AULAS WHERE ATIVO = 1 AND IDTURMA = IDTURMA; It will always return true as i...
asked by 24.03.2017 / 15:38
2
answers

PHP - authorize only one area of the website to the user

I have a search bar that only registered people can access. until that's fine my code is working, the problem with each search in the search bar credentials are requested, ie my code requires every time you log in. but I just want to ask you to...
asked by 07.05.2017 / 11:41
1
answer

I can not restore database in mysql

I'm trying to restore a DBS that I have on my machine, but unfortunately I'm having problems ... ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to u...
asked by 05.05.2017 / 19:55
1
answer

Rename values in mysql

I have the following sql query: select nf,status from notas where status = 3 Instead of bringing the number 3 in the sql query result, I wanted to show another message: "complete." How do I rename?     
asked by 29.08.2017 / 15:46
2
answers

Update Inner Join (update in two tables) - Php; Mysql

I have two tables and I want to make a join to do an update on both at the same time. Table1: Clipping (id, dia_semana, data) Table2: imagemClipping( id, id_clipping, titulo, dia_semana, data, imagem) The id_clipping is th...
asked by 29.08.2017 / 22:52
1
answer

Database with many changes

Situation I'm making a system for a drugstore. The Client can enter the pharmacy and take products only from the gland and pass directly in the box, or you can pass the counter and just take the antibiotic at the counter with a pharmacist, or...
asked by 30.08.2017 / 00:02
1
answer

How to limit a JDBC connection to only doing "select" queries?

I would like my JDBC connection to not make queries that can make changes to the tables (insert, delete, update, drop). Is there any way to do this?     
asked by 17.02.2017 / 19:56
2
answers

How to add 2 columns?

I have 2 subselects , SQL , which bring 2 different information with the sum of the data. How to do to sum the 2 " sums " and bring in a new column, or a single column? CASE WHEN sd3.D3_UM = 'PC' THEN (SELECT ISNULL(sum(sd3_...
asked by 06.04.2017 / 12:55