public static function getFormulaAsQueryPart(
        $firstLatitude,
        $firstLongitude,
        $secondLatitude,
        $secondLongitude,
        $digits = 0,
        $earthRadius = self::EARTH_RADIUS_IN_KM
    ): string {
        return \sprintf(
            'ROUND(
                SQRT(
                    POWER(2 * PI() / 360 * (CAST(%1$s AS DECIMAL(9,6)) - CAST(%3$s AS DECIMAL(9,6))) * %6$s, 2) 
                    + POWER(2 * PI() / 360 * (CAST(%2$s AS DECIMAL(9,6)) - CAST(%4$s AS DECIMAL(9,6))) * %6$s 
                        * COS(2 * PI() / 360 * (CAST(%1$s AS DECIMAL(9,6)) + CAST(%3$s AS DECIMAL(9,6))) * 0.5), 2)
                ), %5$s
            )',
            $firstLatitude,
            $firstLongitude,
            $secondLatitude,
            $secondLongitude,
            $digits,
            $earthRadius
        );
    }