The EPiServer Pages and Properties From the Database Point Of View.
As you can see the tables tblPage and tblWorkPage are connected with “one – to - many ” relation. The main record about the page is stored in tblPage and the page versions records are saved in the tblWorkPage. The query getting all the versions for the page with id = 49 looks this way:
select * from tblPage p
join tblPageType pt on p.fkPageTypeID = pt.pkID
join tblWorkPage wp on wp.fkPageID = p.pkID
where p.pkID = 49
When you create new page new record is added to the tblPage table. Everytime you publish new version of the page the correspondent record is inserted into the tblWorkPage. Information about the page current version is stored in tblPageLanguage.PublishedVersion field which can contain one of the tblWorkPage.pkID values.
Evidently, if you need to get the properties values for the given page version ( f.e.130) you should execute
select * from tblWorkProperty where fkWorkPageID = 130,
where fkWorkPageID is a foreign key to tblWorkPage. So in much the same way the tblWorkProperty table keeps the history of properties values and tblProperty contains just a single record about given property – the value when created.