SHARE
TWEET

Untitled

a guest Jun 15th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USE [Cube]
  2. GO
  3.  
  4. DROP TABLE IF EXISTS DimMovie;
  5. GO
  6.  
  7. CREATE TABLE [dbo].[DimMovie](
  8.     [movieID] [nvarchar](10) NOT NULL,
  9.     [primaryTitle] [nvarchar](255) NULL,
  10.     [originalTitle] [nvarchar](255) NULL,
  11.     [runtimeMinutes] [int] NULL,
  12.     [runtimeRange] [nvarchar](15) NULL,
  13.     [budget] [int] NULL,
  14.     [budgetRange] [nvarchar](30) NULL,
  15.     [primaryLanguage] [nvarchar](10) NULL
  16.  CONSTRAINT [DimMoviePK] PRIMARY KEY CLUSTERED
  17. (
  18.     [movieID] ASC
  19. ) ON [PRIMARY]
  20. ) ON [PRIMARY]
  21. GO
  22.  
  23. INSERT INTO DimMovie
  24. SELECT movieID, primaryTitle, originalTitle, runtimeMinutes,
  25. CASE
  26.     WHEN runtimeMinutes <= 60 THEN '0 - 60'
  27.     WHEN runtimeMinutes > 60 AND runtimeMinutes <= 75 THEN '60 - 75'
  28.     WHEN runtimeMinutes > 75 AND runtimeMinutes <= 90 THEN '75 - 90'
  29.     WHEN runtimeMinutes > 90 AND runtimeMinutes <= 105  THEN '90 - 105'
  30.     WHEN runtimeMinutes > 105 AND runtimeMinutes <= 120  THEN '105 - 120'
  31.     WHEN runtimeMinutes > 120 THEN '> 120'
  32.     ELSE 'UNKNOWN'
  33. END as runtimeRange,
  34. budget,
  35. CASE
  36.     WHEN budget <= 1000000 THEN '0 - 1 000 000'
  37.     WHEN budget > 1000000 AND budget <= 5000000 THEN '1 000 000 - 5 000 000'
  38.     WHEN budget > 5000000 AND budget <= 10000000 THEN '5 000 000 - 10 000 000'
  39.     WHEN budget > 10000000 AND budget <= 25000000 THEN '10 000 000 - 25 000 000'
  40.     WHEN budget > 25000000 AND budget <= 50000000  THEN '25 000 000 - 50 000 000'
  41.     WHEN budget > 50000000 AND budget <= 100000000  THEN '50 000 000 - 100 000 000'
  42.     WHEN budget > 100000000 THEN '> 100 000 000'
  43.     ELSE 'UNKNOWN'
  44. END as budgetRange,
  45. ISNULL(primaryLanguage, 'UNKNOWN')
  46. FROM IntermediateDB.dbo.Movie
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