Im a beginner in sqlite and I want to use sqlite in a database where I have three tables one as a junction table for the two tables. The two tables are named users and stocks table. I know that the user id in the users table will auto increment itself since it made it a primary key. Now in the stocks table I want it to increment it but it must start at 1 again if the stock is connected to another user which can be identified in the junction table.
Here is my schema
And this is my idea on how I want my junction table to look like