Introduction: Sonar platform is a popular static code scanning platform, it is necessary to learn and understand its database structure for ease of use and two times of development.
Title, at present the network does not find relevant content, only oneself slowly tidy up, as the information, for query.
=========================================================================================
Query the most frequently scanned rule for a month: SELECT i.rule_id,r.name as Rulename,count (*) as Count,from_unixtime (i.created_at/1000) as Createtime, R.priority,i.severity,r.plugin_name from issues i,rules r WHERE i.rule_id = R.id and From_unixtime (i.created_at/1000) < ;‘ 2017-09-01 ' and From_unixtime (i.created_at/1000) > ' 2017-08-01 ' GROUP by i.rule_id ORDER by COUNT desc================ ========================================================================= Querying all items: SELECT NAME from Projects WHERE Scope= ' PRJ ' ========================================================================================= Query all questions in the month and the corresponding project name, author, rule ID, severity level, and more: SELECT P.name as Projectname,i.rule_id,i.message,i.author_login,from_unixtime ( i.created_at/1000) as createtime,i.severity from issues i,projects pwhere p.project_uuid=i.project_uuid and P.scope= ' PRJ ' and From_unixtime (i.created_at/1000) < ' 2017-09-01 ' and From_unixtime (i.created_at/1000) > ' 2017-08-01 ' ORDER by rule_id desc=========================================================================================
Author Original technical Articles, reproduced please indicate the source
Sonar database table relationship finishing one (cont.)