Changes between Version 11 and Version 12 of AdvancedReports
- Timestamp:
- 02/02/26 20:43:05 (4 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AdvancedReports
v11 v12 204 204 205 205 WITH followersCount AS ( 206 SELECT a.user_id AS artist,206 SELECT a.user_id, 207 207 pa.event_id, 208 208 COALESCE(COUNT(f.follower),0) AS followers … … 214 214 listensCount AS ( 215 215 SELECT 216 a.user_id AS artist,216 a.user_id, 217 217 COALESCE(COUNT(l.timestamp),0) AS listen_count 218 218 FROM artists a … … 230 230 FROM events e 231 231 JOIN performs_at pa ON pa.event_id=e.event_id 232 JOIN followersCount fc ON fc. artist=pa.artist_id233 JOIN listensCount lc ON lc. artist=fc.artist234 JOIN users u ON u.user_id=lc. artist232 JOIN followersCount fc ON fc.user_id=pa.artist_id 233 JOIN listensCount lc ON lc.user_id=fc.user_id 234 JOIN users u ON u.user_id=lc.user_id 235 235 WHERE not exists( 236 236 SELECT 1 237 237 FROM artists a 238 JOIN followersCount fc1 ON a.user_id=fc1. artist239 JOIN listensCount lc1 ON lc1. artist=fc1.artist238 JOIN followersCount fc1 ON a.user_id=fc1.user_id 239 JOIN listensCount lc1 ON lc1.user_id=fc1.user_id 240 240 WHERE fc.event_id=fc1.event_id 241 241 AND (fc.followers<fc1.followers 242 242 OR (fc.followers=fc1.followers AND lc.listen_count<lc1.listen_count) 243 OR (fc.followers=fc1.followers AND lc.listen_count=lc1.listen_count AND lc. artist<lc1.artist)243 OR (fc.followers=fc1.followers AND lc.listen_count=lc1.listen_count AND lc.user_id<lc1.user_id) 244 244 ) 245 245 ); 246 246 247 }}} 247 248 248 249 ==== Релациона Алгебра 250 249 251 {{{ 250 252 FollowersCount <- 251 γ artist:= a.user_id,253 γ user_id := a.user_id, 252 254 event_id := pa.event_id; 253 255 followers := COUNT(f.follower) … … 258 260 259 261 ListensCount <- 260 γ artist:= a.user_id;262 γ user_id := a.user_id; 261 263 listen_count := COUNT(l.timestamp) 262 264 ( … … 276 278 ⨝ (e.event_id = pa.event_id) performs_at pa 277 279 ) 278 ⨝ (pa.artist_id = fc. artist) FollowersCount fc279 ) 280 ⨝ (fc.artist = lc.artist)ListensCount lc281 ) 282 ⨝ (lc.artist = u.user_id)users u280 ⨝ (pa.artist_id = fc.user_id) FollowersCount fc 281 ) 282 ⨝ ListensCount lc 283 ) 284 ⨝ users u 283 285 ) 284 286 … … 289 291 fc.followers < fc1.followers 290 292 ∨ (fc.followers = fc1.followers ∧ lc.listen_count < lc1.listen_count) 291 ∨ (fc.followers = fc1.followers ∧ lc.listen_count = lc1.listen_count ∧ lc. artist < lc1.artist)293 ∨ (fc.followers = fc1.followers ∧ lc.listen_count = lc1.listen_count ∧ lc.user_id < lc1.user_id) 292 294 ) 293 295 ( … … 300 302 BaseResult − π attributes(BaseResult) 301 303 ( 302 BaseResult ⨝ (BaseResult.artist = ToRemove.artist)ToRemove304 BaseResult ⨝ ToRemove 303 305 ) 304 306
