'How to give the user 100 rows as the maximum inside a specific table?
I have this table inside MySQL
History (Table Name)
|
--- id (Primary Key)
--- user_id
--- video_id
--- date_of_watch
When the user watches any video I'll store it inside the History table, Something like Youtube History, If the user watched 850 videos then in the normal situation he must have 850 rows inside the History table, But I want every user must have 100 rows as maximum inside the History table, But If the user has more than 100 rows then I want to delete the older row by the date and record the new row.
What is the best way to do something like this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
