mysql语法

产生随机数(30-200)

update paver_data_1 set PAVER_DATA_TEMP= floor( 30 + rand()*170)


组合索引

alter table compactor_data_geohashed_1 add index time_geohash(COMPACTOR_DATA_GEOHASHED_TIME ,COMPACTOR_DATA_GEOHASHED_GEOHASH);

(备注:组合索引比单独建索引更快,因为索引是一个一个执行的,如果单独建两个索引A、B,先执行完A在执行B)


权限

 SELECT

r.APPLICATION_ID,

        r.APPLICATION_NAME,

        r.APPLICATION_GROUP_ID,

        r.APPLICATION_URL,

        r.APPLICATION_PARAMETER,

        ra.ROLE_ID,

        ra.ROLE_APPLICATION_PRIVILEGE,

        ra.ROLE_APPLICATION_ID,

        FROM

        APPLICATION r, ROLE_APPLICATION_RS ra, APPLICATION_GROUP ag

        WHERE r.APPLICATION_ID = ra.APPLICATION_ID

        and ag.APPLICATION_GROUP_ID =  r.APPLICATION_GROUP_ID

        and ra.ROLE_APPLICATION_PRIVILEGE =

        ( SELECT

max(t.ROLE_APPLICATION_PRIVILEGE)

FROM

ROLE_APPLICATION_RS t

WHERE

t.APPLICATION_ID = r.APPLICATION_ID

        )

        AND ra.ROLE_ID IN

        (2,12)

        group by r.APPLICATION_ID

你可能感兴趣的:(mysql语法)