Adding data to a table

Populate the created tables with data using the REPLACE INTO statement.

  1. REPLACE INTO series (series_id, title, release_date, series_info)
  2. VALUES
  3. -- By default, numeric literals have type Int32
  4. -- if the value is within the range.
  5. -- Otherwise, they automatically expand to Int64.
  6. (
  7. 1,
  8. "IT Crowd",
  9. CAST(Date("2006-02-03") AS Uint64), -- CAST converts one datatype into another.
  10. -- You can convert a string
  11. -- literal into a primitive literal.
  12. -- The Date() function converts a string
  13. -- literal in ISO 8601 format into a date.
  14. "The IT Crowd is a British sitcom produced by Channel 4, written by Graham Linehan, produced by Ash Atalla and starring Chris O'Dowd, Richard Ayoade, Katherine Parkinson, and Matt Berry."),
  15. (
  16. 2,
  17. "Silicon Valley",
  18. CAST(Date("2014-04-06") AS Uint64),
  19. "Silicon Valley is an American comedy television series created by Mike Judge, John Altschuler and Dave Krinsky. The series focuses on five young men who founded a startup company in Silicon Valley."
  20. )
  21. ;
  22. REPLACE INTO seasons (series_id, season_id, title, first_aired, last_aired)
  23. VALUES
  24. (1, 1, "Season 1", CAST(Date("2006-02-03") AS Uint64), CAST(Date("2006-03-03") AS Uint64)),
  25. (1, 2, "Season 2", CAST(Date("2007-08-24") AS Uint64), CAST(Date("2007-09-28") AS Uint64)),
  26. (1, 3, "Season 3", CAST(Date("2008-11-21") AS Uint64), CAST(Date("2008-12-26") AS Uint64)),
  27. (1, 4, "Season 4", CAST(Date("2010-06-25") AS Uint64), CAST(Date("2010-07-30") AS Uint64)),
  28. (2, 1, "Season 1", CAST(Date("2014-04-06") AS Uint64), CAST(Date("2014-06-01") AS Uint64)),
  29. (2, 2, "Season 2", CAST(Date("2015-04-12") AS Uint64), CAST(Date("2015-06-14") AS Uint64)),
  30. (2, 3, "Season 3", CAST(Date("2016-04-24") AS Uint64), CAST(Date("2016-06-26") AS Uint64)),
  31. (2, 4, "Season 4", CAST(Date("2017-04-23") AS Uint64), CAST(Date("2017-06-25") AS Uint64)),
  32. (2, 5, "Season 5", CAST(Date("2018-03-25") AS Uint64), CAST(Date("2018-05-13") AS Uint64))
  33. ;
  34. REPLACE INTO episodes (series_id, season_id, episode_id, title, air_date)
  35. VALUES
  36. (1, 1, 1, "Yesterday's Jam", CAST(Date("2006-02-03") AS Uint64)),
  37. (1, 1, 2, "Calamity Jen", CAST(Date("2006-02-03") AS Uint64)),
  38. (1, 1, 3, "Fifty-Fifty", CAST(Date("2006-02-10") AS Uint64)),
  39. (1, 1, 4, "The Red Door", CAST(Date("2006-02-17") AS Uint64)),
  40. (1, 1, 5, "The Haunting of Bill Crouse", CAST(Date("2006-02-24") AS Uint64)),
  41. (1, 1, 6, "Aunt Irma Visits", CAST(Date("2006-03-03") AS Uint64)),
  42. (1, 2, 1, "The Work Outing", CAST(Date("2006-08-24") AS Uint64)),
  43. (1, 2, 2, "Return of the Golden Child", CAST(Date("2007-08-31") AS Uint64)),
  44. (1, 2, 3, "Moss and the German", CAST(Date("2007-09-07") AS Uint64)),
  45. (1, 2, 4, "The Dinner Party", CAST(Date("2007-09-14") AS Uint64)),
  46. (1, 2, 5, "Smoke and Mirrors", CAST(Date("2007-09-21") AS Uint64)),
  47. (1, 2, 6, "Men Without Women", CAST(Date("2007-09-28") AS Uint64)),
  48. (1, 3, 1, "From Hell", CAST(Date("2008-11-21") AS Uint64)),
  49. (1, 3, 2, "Are We Not Men?", CAST(Date("2008-11-28") AS Uint64)),
  50. (1, 3, 3, "Tramps Like Us", CAST(Date("2008-12-05") AS Uint64)),
  51. (1, 3, 4, "The Speech", CAST(Date("2008-12-12") AS Uint64)),
  52. (1, 3, 5, "Friendface", CAST(Date("2008-12-19") AS Uint64)),
  53. (1, 3, 6, "Calendar Geeks", CAST(Date("2008-12-26") AS Uint64)),
  54. (1, 4, 1, "Jen The Fredo", CAST(Date("2010-06-25") AS Uint64)),
  55. (1, 4, 2, "The Final Countdown", CAST(Date("2010-07-02") AS Uint64)),
  56. (1, 4, 3, "Something Happened", CAST(Date("2010-07-09") AS Uint64)),
  57. (1, 4, 4, "Italian For Beginners", CAST(Date("2010-07-16") AS Uint64)),
  58. (1, 4, 5, "Bad Boys", CAST(Date("2010-07-23") AS Uint64)),
  59. (1, 4, 6, "Reynholm vs Reynholm", CAST(Date("2010-07-30") AS Uint64)),
  60. (2, 1, 1, "Minimum Viable Product", CAST(Date("2014-04-06") AS Uint64)),
  61. (2, 1, 2, "The Cap Table", CAST(Date("2014-04-13") AS Uint64)),
  62. (2, 1, 3, "Articles of Incorporation", CAST(Date("2014-04-20") AS Uint64)),
  63. (2, 1, 4, "Fiduciary Duties", CAST(Date("2014-04-27") AS Uint64)),
  64. (2, 1, 5, "Signaling Risk", CAST(Date("2014-05-04") AS Uint64)),
  65. (2, 1, 6, "Third Party Insourcing", CAST(Date("2014-05-11") AS Uint64)),
  66. (2, 1, 7, "Proof of Concept", CAST(Date("2014-05-18") AS Uint64)),
  67. (2, 1, 8, "Optimal Tip-to-Tip Efficiency", CAST(Date("2014-06-01") AS Uint64)),
  68. (2, 2, 1, "Sand Hill Shuffle", CAST(Date("2015-04-12") AS Uint64)),
  69. (2, 2, 2, "Runaway Devaluation", CAST(Date("2015-04-19") AS Uint64)),
  70. (2, 2, 3, "Bad Money", CAST(Date("2015-04-26") AS Uint64)),
  71. (2, 2, 4, "The Lady", CAST(Date("2015-05-03") AS Uint64)),
  72. (2, 2, 5, "Server Space", CAST(Date("2015-05-10") AS Uint64)),
  73. (2, 2, 6, "Homicide", CAST(Date("2015-05-17") AS Uint64)),
  74. (2, 2, 7, "Adult Content", CAST(Date("2015-05-24") AS Uint64)),
  75. (2, 2, 8, "White Hat/Black Hat", CAST(Date("2015-05-31") AS Uint64)),
  76. (2, 2, 9, "Binding Arbitration", CAST(Date("2015-06-07") AS Uint64)),
  77. (2, 2, 10, "Two Days of the Condor", CAST(Date("2015-06-14") AS Uint64)),
  78. (2, 3, 1, "Founder Friendly", CAST(Date("2016-04-24") AS Uint64)),
  79. (2, 3, 2, "Two in the Box", CAST(Date("2016-05-01") AS Uint64)),
  80. (2, 3, 3, "Meinertzhagen's Haversack", CAST(Date("2016-05-08") AS Uint64)),
  81. (2, 3, 4, "Maleant Data Systems Solutions", CAST(Date("2016-05-15") AS Uint64)),
  82. (2, 3, 5, "The Empty Chair", CAST(Date("2016-05-22") AS Uint64)),
  83. (2, 3, 6, "Bachmanity Insanity", CAST(Date("2016-05-29") AS Uint64)),
  84. (2, 3, 7, "To Build a Better Beta", CAST(Date("2016-06-05") AS Uint64)),
  85. (2, 3, 8, "Bachman's Earnings Over-Ride", CAST(Date("2016-06-12") AS Uint64)),
  86. (2, 3, 9, "Daily Active Users", CAST(Date("2016-06-19") AS Uint64)),
  87. (2, 3, 10, "The Uptick", CAST(Date("2016-06-26") AS Uint64)),
  88. (2, 4, 1, "Success Failure", CAST(Date("2017-04-23") AS Uint64)),
  89. (2, 4, 2, "Terms of Service", CAST(Date("2017-04-30") AS Uint64)),
  90. (2, 4, 3, "Intellectual Property", CAST(Date("2017-05-07") AS Uint64)),
  91. (2, 4, 4, "Teambuilding Exercise", CAST(Date("2017-05-14") AS Uint64)),
  92. (2, 4, 5, "The Blood Boy", CAST(Date("2017-05-21") AS Uint64)),
  93. (2, 4, 6, "Customer Service", CAST(Date("2017-05-28") AS Uint64)),
  94. (2, 4, 7, "The Patent Troll", CAST(Date("2017-06-04") AS Uint64)),
  95. (2, 4, 8, "The Keenan Vortex", CAST(Date("2017-06-11") AS Uint64)),
  96. (2, 4, 9, "Hooli-Con", CAST(Date("2017-06-18") AS Uint64)),
  97. (2, 4, 10, "Server Error", CAST(Date("2017-06-25") AS Uint64)),
  98. (2, 5, 1, "Grow Fast or Die Slow", CAST(Date("2018-03-25") AS Uint64)),
  99. (2, 5, 2, "Reorientation", CAST(Date("2018-04-01") AS Uint64)),
  100. (2, 5, 3, "Chief Operating Officer", CAST(Date("2018-04-08") AS Uint64)),
  101. (2, 5, 4, "Tech Evangelist", CAST(Date("2018-04-15") AS Uint64)),
  102. (2, 5, 5, "Facial Recognition", CAST(Date("2018-04-22") AS Uint64)),
  103. (2, 5, 6, "Artificial Emotional Intelligence", CAST(Date("2018-04-29") AS Uint64)),
  104. (2, 5, 7, "Initial Coin Offering", CAST(Date("2018-05-06") AS Uint64)),
  105. (2, 5, 8, "Fifty-One Percent", CAST(Date("2018-05-13") AS Uint64));
  106. COMMIT;

Adding data to a table - 图1