[Maria-discuss] How to select values at particular time with two temporal tables in MariaDB?
Hi, I'm interested in using MariaDB for temporal data but I'm a bit uncertain on how to solve certain use cases. As an example let's say I define two temporal tables<https://mariadb.com/kb/en/temporal-data-tables> using application time periods<https://mariadb.com/kb/en/temporal-data-tables/#application-time-periods> where one table has a one to many relationship with the other. For example: [cid:8f4d19a2-4743-4e32-9516-16a626f9169f] What I'm looking for is a way to "select a teacher and count the number of associated classes for this teacher" at a moment in time. My questions are: 1. How would I define/create the two tables using temporal tables? 2. What would such a select statement look like? 3. What indexes should be created in order to make the select statement efficient? Note that it's very important that the query is expressed using application time and not system time. BR, /Johan
participants (1)
-
unit unit