Timeline for MySQL Trigger updating second table based on History and computed values
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 14 at 21:48 | comment | added | Wisdom | @Akina about the structure, I created this way with a focus on reducing data traffic, since NULL takes up less bandwidth (thinking about optimization for the website to load quickly and space on database) than using zero or another value, and with the inner join I keep distinct data without duplication as it should be in relational databases. | |
May 14 at 21:47 | comment | added | Wisdom |
Hey @Akina, thanks for your help, I believe the PRIMARY keys relevant to the case are the Id field in both tables created with the command: ALTER TABLE Lottery_History ADD PRIMARY KEY (Id ) USING BTREE, ALTER TABLE Lottery_Cycle ADD PRIMARY KEY (Id ) USING BTREE, I managed to obtain the desired result and I will share it in a new answer below, as well as the link to the website from which I was inspired. What do you suggest for normalization?
|
|
May 14 at 21:38 | comment | added | Wisdom | Hey @nbk, thanks for your help, after I removed triggers one and two as you advised, I focused on the third trigger and finally managed to get the desired result, I will share it in a new answer. PS.: This is a hobby of cloning statistics websites and I only continue when I get home, sorry for the delay in responding. | |
May 14 at 21:37 | answer | added | Wisdom | timeline score: 0 | |
May 14 at 4:42 | comment | added | Akina | What are PKs in your tables? Anycase - normalize your structure. | |
May 13 at 23:30 | comment | added | nbk | you have two before insert trigger tat make not much sense, combine them, also debugging is simple define some user-defined variables like @a, @b and so on and check with a select which variables where filled to get the perpetrator | |
S May 13 at 23:19 | review | First questions | |||
May 14 at 9:47 | |||||
S May 13 at 23:19 | history | asked | Wisdom | CC BY-SA 4.0 |