I’m creating a note-taking application. I want to retrieve notes by retrieving the note id (1 or 2 or 3 etc.) from the user_id.
For example, I want to retrieve note 3 from user 1 and also retrieve note 3 from user 2, but I want the note numbers to auto-increment for each user.
I’m creating a note-taking application. I want to retrieve notes by retrieving the note
Share
If your app does not have to deal with a lot of concurrency (only one instance of the same user is online at any given time), then this simple solution will work just fine:
Be sure to have an index on
user_idin the tablenotesor even on(user_id, note_id)to make the look-up fast.