SELECT to_char("publicationDate", 'mm') as month,
to_char("publicationDate", 'yyyy') as year,
count( "entryId" ) as entryCount
FROM "Entry"
GROUP BY to_char("publicationDate", 'yyyy'),
to_char("publicationDate", 'mm')
ORDER BY to_char("publicationDate", 'yyyy') desc,
to_char("publicationDate", 'mm') desc
SELECT e."entryId",
e."title",
e."preview",
to_char(e."publicationDate", 'mm/dd/yyyy') as publicationDate,
e."publicationDate" as publicationDateTime,
e."views",
c."categoryId",
c."name" as categoryName,
u."firstName",
u."lastName",
e."disableComments",
count(DISTINCT m."commentId") as commentCount,
count(e."entryId") as temp1,
CASE
WHEN e."timesRated" = 0 THEN 0
ELSE ( e."totalRating"/e."timesRated" )
END AS averageRating
FROM "Entry" e LEFT JOIN "EntryCategory" ec
ON e."entryId" = ec."entryId"
LEFT JOIN "Category" c
ON ec."categoryId" = c."categoryId"
JOIN "User" u
ON e."postedByUserId" = u."userId"
LEFT JOIN "Comment" m
ON e."entryId" = m."entryId"
WHERE e."publicationDate" <= trunc(sysdate)
AND c."categoryId" =
AND to_char(e."publicationDate", 'mm') =
AND to_char(e."publicationDate", 'yyyy') =
AND e."publicationDate" - trunc(sysdate) <=
GROUP BY e."entryId",
e."title",
e."preview",
to_char(e."publicationDate", 'mm/dd/yyyy'),
e."publicationDate",
e."views",
c."categoryId",
c."name",
u."firstName",
u."lastName",
e."disableComments",
CASE
WHEN e."timesRated" = 0 THEN 0
ELSE (e."totalRating"/e."timesRated")
END
ORDER BY e."publicationDate" DESC
SELECT e."entryId",
e."title",
CASE
WHEN e."timesRated" = 0 THEN 0
ELSE (e."totalRating"/e."timesRated")
END AS averageRating
FROM "Entry" e
ORDER BY averageRating DESC
SELECT e."entryId",
e."title",
e."views"
FROM "Entry" e
ORDER BY e."views" DESC
SELECT e."entryId",
e."title",
count(c."commentId") as comments
FROM "Entry" e JOIN "Comment" c
ON e."entryId" = c."entryId"
GROUP BY e."entryId", e."title"
ORDER BY comments DESC