SHARE
TWEET

Untitled

a guest Nov 18th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE VIEW PCTEHOME AS
  2. SELECT TEAM1_ID,
  3.     CASE WHEN GOALS_TEAM1>GOALS_TEAM2 THEN 3
  4.           WHEN GOALS_TEAM1=GOALS_TEAM2 THEN 1
  5.           ELSE 0
  6.     END AS PCTEHOME
  7.     FROM SCORE;
  8.  
  9. CREATE VIEW PCTEAWAY AS
  10. SELECT TEAM2_ID,
  11.     CASE WHEN GOALS_TEAM2>GOALS_TEAM1 THEN 3
  12.           WHEN GOALS_TEAM2=GOALS_TEAM1 THEN 1
  13.           ELSE 0
  14.     END AS PCTEAWAY
  15.     FROM SCORE;
  16.    
  17. /*
  18. SELECT TEAM1_ID, PCT
  19. FROM SCORE
  20. WHERE TEAM1_ID
  21.  
  22.  
  23. CREATE VIEW [PCTEAWAY] AS
  24. SELECT TEAM2_ID, PCT
  25. FROM SCORE
  26. WHERE TEAM2_ID
  27. */
  28.  
  29.  
  30. CREATE VIEW PUNCTAJ AS
  31. SELECT TEAM_ID,SUM(PCT)
  32.     FROM (PCTEHOME UNION ALL PCTEAWAY)P , TEAMS T
  33.     WHERE P.TEAM_ID=T.TEAM_ID
  34.     GROUP BY TEAM_ID;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top