Database design - how do I track information over time and query a table for latest data?

前端 未结 5 1358
名媛妹妹
名媛妹妹 2021-01-15 16:01

We are trying to track our applications in our department and our unit test usage so I have created a database to keep track of this. I have an Applications

5条回答
  •  北海茫月
    2021-01-15 16:42

    "Select count of unit tests across all applications where the application data_added is the latest date added for that application id"

    I'm afraid all I can say it that this formulation-of-requirement seems necessarily flawed.

    First, the only "free variable" in your query (i.e. the only parameter) seems to be "that application ID".

    So your problem statement seems to be :

    (1) Given an application ID, get me the latest (i.e. MAX(...)) date_added of that application ID. (2) Given that latest date, give me all the applications that have a date_added that is equal to the result of (1) (3) Given that set of applications, give me the count of unit tests "across those applications"

    Second : with respect to "across those applications", I must say that neither my understanding of relational algebra nor my understanding of natural language helps me the remotest bit to understand what it is (PRECISELY) that you mean.

提交回复
热议问题