SQL query of difficulty?

How to make SQL query to retrieve difficulty of the card? I do not see any column or any other parameters matching what I see in the GUI.

1 Like

I can’t help you with the query itself, but I can tell you that everything related to FSRS is stored in “data” in the cards table. (Although the schema hasn’t been updated. Database Structure · ankidroid/Anki-Android Wiki · GitHub).

1 Like

Indeed, they are there but very strange:

difficulty more then 1? What does it mean? is this old “ease” value? How to recalculate ease to difficulty percent?

No, as you can see in the schema, that’s stored elsewhere.

You can’t do that. Ease and Difficulty are completely independent of each other.

If you want to work with FSRS values, you should get familiar with the scheduler and the algorithm.

Refer to this:

As for the code, you can refer to the FSRS helper add-on. In general, the add-on code should be the first point of reference when you want to retrieve any FSRS-related info.

2 Likes

You can query the difficulty via this way:

SELECT json_extract(data, '$.d')
FROM cards;

For more details, please read the code of the helper add-on:

3 Likes