Baseball Team SQL Script

Posted: February 21, 2019 by Robbie

This is a script for a fictional baseball team called the Ironmen. The team played a very good 22-game season with MVP candidate Hollywood Allan putting up some good numbers.

Here’s the script:

CREATE TABLE Players(
  POS Varchar(3),
  Name Varchar(35),
  G integer(3),
  AB integer(4),
  H integer(3),
  BB integer(3),
  RBI integer(3),
  HBP integer(3),
  SF integer(3),
  K integer(3),
  R integer(3),
  HR integer(3),
  DBL integer(3),
  TRL integer(3),
  PA integer(4),
  AO integer(3),
  GR integer(3),
  GIDP integer(3),
  RBE integer(3),
  XBH integer(3),
  SB integer(3),
  SBA integer(3),
  ER integer(3),
  AVG integer(3),
  OBP integer(3),
  SLG integer(3),
  wOBA integer(3)
);

 INSERT INTO Players VALUES (
    "CF",
    "Mag Launcher",
    18, 82, 30, 6, 21, 0, 1, 16, 19, 7, 10, 0, 88, 22, 14, 0, 0, 17, 1, 1, 0, 0.366, 0.404, 0.744, 0.478);

 INSERT INTO Players VALUES (
	"UT",
	"Robby",
	15, 53, 19, 2, 10, 0, 1, 10, 7, 1, 3, 1, 55, 14, 10, 0,	1, 5, 1, 2, 1, 0.358, 0.375, 0.509, 0.403); 

 INSERT INTO Players VALUES (
	"SS",
	"K.Hancocks",
	21, 	89,	30, 3, 16, 2, 1, 20, 19, 2, 10, 1, 94, 23, 16, 0, 1, 13, 4, 4, 1, 0.337, 0.368, 0.539, 0.401);

 INSERT INTO Players VALUES (
	"RF",
	"Hollywood Allan",
	21,	87,	30,	7,	11,	0,	3,	15,	13,	1,	9,	4,	95,	24,	16,	2,	1,	14,	0,	1,	0,	0.345,	0.381,	0.575,	0.418);

 INSERT INTO Players VALUES (
	"LF",	
	"Lancer",	
	13,	54,	16,	5,	9,	0,	1,	12,	10,	1,	2,	1,	59,	15,	10,	1,	0,	4,	1,	1,	1,	0.296,	0.350,	0.426,	0.346);

 INSERT INTO Players VALUES (
	"OF",
	"Douche Bag",
	16,	64,	16,	6,	15,	1,	2,	23,	14,	3,	5,	0,	72,	17,	8,	0,	0,	8,	2,	2,	1,	0.250,	0.315,	0.469,	0.338);

 INSERT INTO Players VALUES (
	"1B",	
	"Durazo",
	21,	84,	34,	7,	23,	1,	1,	18,	20,	5,	11,	1,	92,	23,	9,	0,	0,	17,	0,	0,	1,	0.405,	0.452,	0.738,	0.500);

 INSERT INTO Players VALUES (
	"C",
	"Jeramila",
	19,	72,	25,	5,	13,	0,	1,	17,	15,	2,	5,	2,	77,	23,	6,	1,	0,	9,	0,	0,	1,	0.347,	0.385,	0.556,	0.405);

 INSERT INTO Players VALUES (
	"3B",	
	"Delmer",
	14,	41,	14,	2,	8,	1,	1,	7,	7,	1,	1,	2,	44,	15,	5,	0,	1,	4,	0,	0,	1,	0.341,	0.378,	0.537,	0.419);

 INSERT INTO Players VALUES (
	"IF",
	"Lucas",
	18,	60,	19,	3,	5,	1,	0,	14,	11,	0,	5,	0,	64,	17,	10,	0,	0,	5,	1,	1,	0,	0.317,	0.359,	0.4,	0.339);

 INSERT INTO Players VALUES (
	"CF",	
	"Air Man",
	17,	69,	27,	5,	16,	0,	0,	10,	15,	3,	7,	2,	75,	19,	13,	0,	0,	12,	0,	1,	0,	0.391,	0.432,	0.681,	0.463);

 INSERT INTO Players VALUES (
	"OF",	
	"Likis",
	7,	16,	3,	1,	2,	0,	0,	7,	3,	0,	1,	1,	17,	4,	2,	0,	0,	2,	0,	0,	0,	0.188,	0.235,	0.375,	0.260);

 INSERT INTO Players VALUES (
	"2B",
	"Lecter",
	5,	12,	5,	0,	5,	0,	2,	1,	1,	0,	1,	0,	13,	6,	0,	0,	0,	1,	0,	0,	1,	0.417,	0.357,	0.500,	0.372);

 INSERT INTO Players VALUES (
	"3B",	
	"Estello",	
	8,	24,	12,	3,	7,	0,	0,	1,	5,	0,	1,	0,	27,	7,	4,	0,	0,	1,	0,	2,	0,	0.500,	0.556,	0.542,	0.493);

 INSERT INTO Players VALUES (
	"3B",	
	"Tilcocks",	
	4,	10,	3,	3,	4,	1,	1,	2,	5,	0,	1,	0,	14,	2,	2,	1,	0,	1,	0,	0,	0,	0.300,	0.467,	0.400,	0.425);

 INSERT INTO Players VALUES (
	"OF",	
	"Robert Jason",
	3,	8,	2,	0,	0,	1,	0,	1,	0,	0,	0,	0,	9,	5,	0,	0,	0,	0,	0,	0,	0,	0.250,	0.333,	0.250,	0.283);

And here’s a screenshot preview from TreeHouse, the chart is a little too big so we have two screenshots. Some of the players are omitted.