code: def get_select_sql(self):
          
          return '(({0}) - ({1}({2}){3}))'.format(
              self.field.get_select_sql(),
              self.name.upper(),
              self.get_field_identifier(),
              self.get_over(),
          )
docs: Calculate the difference between this record's value and the lag/lead record's value