Questions tagged as 'mysql'

1
answer

How to improve this sql code?

I would like to improve this code so I DO NOT REPEAT THE SAME CODE IN THE TWO IFS. I am not in the process of using procedures because I see no need. DECLARE @Ordem VARCHAR (7), @Valor VARCHAR(10) SET @Ordem = 'E' IF @Ordem = 'E' BEGIN SELE...
asked by 30.05.2018 / 22:36
1
answer

Subselect without condition WHERE

I need to do a list with sub select, and I even managed to do it using a condition, but I need to do it without condition with the condition would look something like this: SELECT *,(SELECT PLACA from veiculo WHERE ID_CARRO = "1654641106")...
asked by 09.05.2018 / 03:58
2
answers

What field do I use to store a timestamp in mysql?

I need to store a timestamp with php, but I do not know what would be the best mysql field to use.     
asked by 01.06.2018 / 06:21
1
answer

Error Code: 1215. Can not add foreign key constraint / Error while adding foreign key

I'm trying to create a table called Disciplina , however I'm not getting it because of the foreign keys. I have reviewed several times and can not identify the error, if you can help me, thank you. CREATE TABLE 'Curso' ( 'idCurso' INT...
asked by 21.05.2018 / 20:13
3
answers

Relationship between two tables

Hello, I would like to know how to create a relationship between two tables, Time and Start, and in the beginning I should put the columns: time1, placar1, time2, placar2, and a date. But my question is whether I need to inform the teams fields i...
asked by 17.05.2018 / 16:52
1
answer

Error accessing RDS bank with Heidsql

I get an error message when I log in to the Amazon RDS bank: Access data is correct and the bank is running. Is there any procedure to be done to have access to the RSD bank in Heidsql ??     
asked by 30.04.2018 / 21:02
1
answer

Create and store existing MD5 hash after INSERT

I have an X table, with a field called email and another email_hash, I would like every time a new record with email was inserted, MySQL would use the value of the inserted email and create an MD5 hash and insert into email_hash, as Can I do thi...
asked by 29.04.2018 / 06:30
1
answer

PHP PDO transaction with multiple objects

The idea would be this: I have 3 classes, one for connection to the bank, another for Users and another for Product. The User class with the database tb_usuarios . The Product class with the database tb_produtos . I make...
asked by 18.04.2018 / 13:15
1
answer

Problems stopping tables with UNION

I'm trying to get the top 3 from my table and also the last 2 placed, SITE TO RUN SCRIPT This is my current progress that does not work SELECT ('Podium: ' ||TEAM) as name FROM LEAGUE ORDER BY position ASC LIMIT 3; UNION ALL SELECT ('D...
asked by 17.04.2018 / 19:48
1
answer

Mysql procedure error

I'm trying to create a procedure but I'm getting errors, after a few tries, I've been able to solve some problems, but I'm not getting any. Attempting to create generates error > ERROR 1064 (42000): You have an error in your SQL...
asked by 23.05.2018 / 19:20