SQL Query of Weekly Most Requested WebPage in SharePoint 2013

This sql query brings the most requested webpages in the SharePoint 2013 portal.

Normally you can access Usage Reports from Popularity Trends but if you’re planning to write a custom webpart or want to see the results through sql, use a query like this:
 
 
Use WSS_UsageApplication
Select Top 100 ReferrerUrl,SUM(RequestCount) as Request from RequestUsage
Where (LogTime between (GETDATE() – 7) and GETDATE())
and ReferrerUrl like ‘%.aspx’
and RequestCount!= 0
Group By ReferrerUrl
Order by SUM(RequestCount) DESC