V
V
Vasily Terkin2014-08-20 12:16:43
PostgreSQL
Vasily Terkin, 2014-08-20 12:16:43

How to write trigger or function in Postgresql?

I messed up something in my last question, and it turned out that you can’t add comments to it or change the question itself. So I apologize in advance for duplicating this question.
Initial data: There is a database in which there are two tables:

a8c7e2a8ea384059ae125420839fc705.png

We need to create another table:
a1ba61302f4244c4ab658d36809905cf.png

Where id_player= tourney_hand_player_statistics.id_palyer,
and the cell tourney_hand_player_range.range_p_3betmust contain all unique values lookup_hole_cards.hole_cards​​under the following conditions:
tourney_hand_player_statistics.id_gametype = 1and
tourney_hand_player_statistics.flg_p_3bet = true.
Question: How to write a trigger that would update the content tourney_hand_player_range.range_p_3betfor id_playerwhen new data for this appears id_playerin the table tourney_hand_player_statistics. Or maybe it's better to write a function that would return the data for the desired one id_playerin the form of text?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question