Skip to content

Tag: database

SQL auto_increment behaviour

My first question is: Can I manually input ID into an auto_increment column of a table? For example: I have 10 records with ID from 1 to 10. Can I manually input the 11 record with the ID of 3 (yes, it’s a duplication!) My second question is: I assume that it’s possible to manually input ID number…

Calculating a Moving Average MySQL?

Good Day, I am using the following code to calculate the 9 Day Moving average. But it does not work because it first calculates all of the returned fields before the limit is called. In other words it will calculate all the closes before or equal to that date, and not just the last 9. So I need to calculate