race_winners

Using a user-defined type in a table and queries.

Using a user-defined type in a table and queries.

SOURCE '0_create_keyspace.cql';

DROP TABLE IF EXISTS cycling.race_winners;

SOURCE 'fullname-type.cql';

// START-usetype
CREATE TABLE IF NOT EXISTS cycling.race_winners (
  cyclist_name FROZEN<fullname>, 
  race_name text,
  race_position int,
  PRIMARY KEY (race_name, race_position)
);
// END-usetype

// START-insert
INSERT INTO cycling.race_winners (
  race_name, race_position,
  cyclist_name
) VALUES (
  'National Championships South Africa WJ-ITT (CN)', 1,
  { firstname:'Frances', lastname:'DU TOUT' }
);
// END-insert

INSERT INTO cycling.race_winners (
  race_name, race_position,
  cyclist_name
) VALUES (
  'National Championships South Africa WJ-ITT (CN)', 2,
  { firstname:'Lynette', lastname:'BENSON' }
);

INSERT INTO cycling.race_winners (
  race_name, race_position,
  cyclist_name
) VALUES (
  'National Championships South Africa WJ-ITT (CN)', 3,
  { firstname:'Anja', lastname:'GERBER' }
);

INSERT INTO cycling.race_winners (
  race_name, race_position,
  cyclist_name
) VALUES (
  'National Championships South Africa WJ-ITT (CN)', 4,
  { firstname:'Ame', lastname:'VENTER' }
);

INSERT INTO cycling.race_winners (
  race_name, race_position,
  cyclist_name
) VALUES (
  'National Championships South Africa WJ-ITT (CN)', 5,
  { firstname:'Danielle', lastname:'VAN NIEKERK' }
);

// START-comment_hyphens
SELECT * FROM cycling.race_winners; -- End of line comment
// END-comment_hyphens

// START-comment_slashes
SELECT * FROM cycling.race_winners; // End of line comment
// END-comment_slashes

// START-comment_span
/* This is a 
   comment that spans multiple
   lines */
SELECT * FROM cycling.race_winners;
// END-comment_span