Table storing Tracker datavalues

Which Table stores Tracker datavalues for dhis2 version 2.33

programstageinstance.eventdatavalues = stores the data for a particular stage in JSON format.
trackedentityinstance = stores the tracked entity value which are referenced by above table.

Thanks @adulojusm

In that case, how would someone write an sql script to extract data for a particular program stage?

Get the program stage UUID, with this you can filter the table, but you must know how to read JSON datatype in PostgreSQL.

Cheers

@adulojusm , I thought you would provide a sample sql script