Database schema:

CREATE TABLE "Ball_by_Ball" (
	"Match_Id" INTEGER -- example: ['335988', '335987'],
	"Over_Id" INTEGER -- example: ['2', '1'],
	"Ball_Id" INTEGER -- example: ['2', '1'],
	"Innings_No" INTEGER -- example: ['2', '1'],
	"Team_Batting" INTEGER -- example: ['2', '1'],
	"Team_Bowling" INTEGER -- example: ['2', '1'],
	"Striker_Batting_Position" INTEGER -- example: ['2', '1'],
	"Striker" INTEGER -- example: ['1', '6'],
	"Non_Striker" INTEGER -- example: ['2', '7'],
	"Bowler" INTEGER -- example: ['14', '106'],
	PRIMARY KEY ("Match_Id", "Over_Id", "Ball_Id", "Innings_No"), 
	CONSTRAINT fk_ball_by_ball_match FOREIGN KEY("Match_Id") REFERENCES "Match" ("Match_Id")
)


CREATE TABLE "Batsman_Scored" (
	"Match_Id" INTEGER -- example: ['335988', '335987'],
	"Over_Id" INTEGER -- example: ['2', '1'],
	"Ball_Id" INTEGER -- example: ['2', '1'],
	"Runs_Scored" INTEGER -- example: ['0', '1'],
	"Innings_No" INTEGER -- example: ['2', '1'],
	PRIMARY KEY ("Match_Id", "Over_Id", "Ball_Id", "Innings_No"), 
	CONSTRAINT fk_batsman_scored_match FOREIGN KEY("Match_Id") REFERENCES "Match" ("Match_Id")
)


CREATE TABLE "Batting_Style" (
	"Batting_Id" INTEGER -- example: ['2', '1'],
	"Batting_hand" TEXT -- example: ['Left-hand bat', 'Right-hand bat'],
	PRIMARY KEY ("Batting_Id")
)


CREATE TABLE "Bowling_Style" (
	"Bowling_Id" INTEGER -- example: ['2', '1'],
	"Bowling_skill" TEXT -- example: ['Right-arm medium', 'Right-arm offbreak'],
	PRIMARY KEY ("Bowling_Id")
)


CREATE TABLE "City" (
	"City_Id" INTEGER -- example: ['2', '1'],
	"City_Name" TEXT -- example: ['Bangalore', 'Chandigarh'],
	"Country_id" INTEGER -- example: ['2', '1'],
	PRIMARY KEY ("City_Id")
)


CREATE TABLE "Country" (
	"Country_Id" INTEGER -- example: ['2', '1'],
	"Country_Name" TEXT -- example: ['India', 'South Africa'],
	PRIMARY KEY ("Country_Id"), 
	CONSTRAINT fk_country_country FOREIGN KEY("Country_Id") REFERENCES "Country" ("Country_Id")
)


CREATE TABLE "Extra_Runs" (
	"Match_Id" INTEGER -- example: ['335988', '335987'],
	"Over_Id" INTEGER -- example: ['2', '1'],
	"Ball_Id" INTEGER -- example: ['2', '1'],
	"Extra_Type_Id" INTEGER -- example: ['2', '1'],
	"Extra_Runs" INTEGER -- example: ['1', '4'],
	"Innings_No" INTEGER -- example: ['2', '1'],
	PRIMARY KEY ("Match_Id", "Over_Id", "Ball_Id", "Innings_No"), 
	CONSTRAINT fk_extra_runs_extra_type FOREIGN KEY("Extra_Type_Id") REFERENCES "Extra_Type" ("Extra_Id")
)


CREATE TABLE "Extra_Type" (
	"Extra_Id" INTEGER -- example: ['2', '1'],
	"Extra_Name" TEXT -- example: ['legbyes', 'wides'],
	PRIMARY KEY ("Extra_Id")
)


CREATE TABLE "Match" (
	"Match_Id" INTEGER -- example: ['335988', '335987'],
	"Team_1" INTEGER -- example: ['2', '4'],
	"Team_2" INTEGER -- example: ['1', '3'],
	"Match_Date" DATE -- example: ['2008-04-18', '2008-04-19'],
	"Season_Id" INTEGER -- example: ['2', '1'],
	"Venue_Id" INTEGER -- example: ['2', '1'],
	"Toss_Winner" INTEGER -- example: ['2', '3'],
	"Toss_Decide" INTEGER -- example: ['2', '1'],
	"Win_Type" INTEGER -- example: ['2', '1'],
	"Win_Margin" INTEGER -- example: ['140', '33'],
	"Outcome_type" INTEGER -- example: ['1', '3'],
	"Match_Winner" INTEGER -- example: ['1', '3'],
	"Man_of_the_Match" INTEGER -- example: ['2', '19'],
	PRIMARY KEY ("Match_Id"), 
	CONSTRAINT fk_match_team FOREIGN KEY("Team_1") REFERENCES "Team" ("Team_Id"),
	CONSTRAINT fk_match_team FOREIGN KEY("Team_2") REFERENCES "Team" ("Team_Id"),
	CONSTRAINT fk_match_season FOREIGN KEY("Season_Id") REFERENCES "Season" ("Season_Id"),
	CONSTRAINT fk_match_venue FOREIGN KEY("Venue_Id") REFERENCES "Venue" ("Venue_Id"),
	CONSTRAINT fk_match_team FOREIGN KEY("Toss_Winner") REFERENCES "Team" ("Team_Id"),
	CONSTRAINT fk_match_toss_decision FOREIGN KEY("Toss_Decide") REFERENCES "Toss_Decision" ("Toss_Id"),
	CONSTRAINT fk_match_win_by FOREIGN KEY("Win_Type") REFERENCES "Win_By" ("Win_Id"),
	CONSTRAINT fk_match_out_type FOREIGN KEY("Outcome_type") REFERENCES "Out_Type" ("Out_Id"),
	CONSTRAINT fk_match_team FOREIGN KEY("Match_Winner") REFERENCES "Team" ("Team_Id"),
	CONSTRAINT fk_match_player FOREIGN KEY("Man_of_the_Match") REFERENCES "Player" ("Player_Id")
)


CREATE TABLE "Out_Type" (
	"Out_Id" INTEGER -- example: ['2', '1'],
	"Out_Name" TEXT -- example: ['caught', 'bowled'],
	PRIMARY KEY ("Out_Id")
)


CREATE TABLE "Outcome" (
	"Outcome_Id" INTEGER -- example: ['2', '1'],
	"Outcome_Type" TEXT -- example: ['No Result', 'Result'],
	PRIMARY KEY ("Outcome_Id")
)


CREATE TABLE "Player" (
	"Player_Id" INTEGER -- example: ['2', '1'],
	"Player_Name" TEXT -- example: ['SC Ganguly', 'BB McCullum'],
	"DOB" DATE -- example: ['1972-07-08', '1981-09-27'],
	"Batting_hand" INTEGER -- example: ['2', '1'],
	"Bowling_skill" INTEGER -- example: ['2', '1'],
	"Country_Name" INTEGER -- example: ['1', '4'],
	PRIMARY KEY ("Player_Id"), 
	CONSTRAINT fk_player_batting_style FOREIGN KEY("Batting_hand") REFERENCES "Batting_Style" ("Batting_Id"),
	CONSTRAINT fk_player_bowling_style FOREIGN KEY("Bowling_skill") REFERENCES "Bowling_Style" ("Bowling_Id"),
	CONSTRAINT fk_player_country FOREIGN KEY("Country_Name") REFERENCES "Country" ("Country_Id")
)


CREATE TABLE "Player_Match" (
	"Match_Id" INTEGER -- example: ['335988', '335987'],
	"Player_Id" INTEGER -- example: ['2', '1'],
	"Role_Id" INTEGER -- example: ['1', '3'],
	"Team_Id" INTEGER -- example: ['2', '1'],
	PRIMARY KEY ("Match_Id", "Player_Id", "Role_Id"), 
	CONSTRAINT fk_player_match_match FOREIGN KEY("Match_Id") REFERENCES "Match" ("Match_Id"),
	CONSTRAINT fk_player_match_player FOREIGN KEY("Player_Id") REFERENCES "Player" ("Player_Id"),
	CONSTRAINT fk_player_match_team FOREIGN KEY("Team_Id") REFERENCES "Team" ("Team_Id"),
	CONSTRAINT fk_player_match_rolee FOREIGN KEY("Role_Id") REFERENCES "Rolee" ("Role_Id")
)


CREATE TABLE "Rolee" (
	"Role_Id" INTEGER -- example: ['2', '1'],
	"Role_Desc" TEXT -- example: ['Keeper', 'Captain'],
	PRIMARY KEY ("Role_Id")
)


CREATE TABLE "Season" (
	"Season_Id" INTEGER -- example: ['2', '1'],
	"Man_of_the_Series" INTEGER -- example: ['53', '32'],
	"Orange_Cap" INTEGER -- example: ['18', '100'],
	"Purple_Cap" INTEGER -- example: ['102', '61'],
	"Season_Year" INTEGER -- example: ['2008', '2009'],
	PRIMARY KEY ("Season_Id")
)


CREATE TABLE "Team" (
	"Team_Id" INTEGER -- example: ['2', '1'],
	"Team_Name" TEXT -- example: ['Kolkata Knight Riders', 'Royal Challengers Bangalore'],
	PRIMARY KEY ("Team_Id")
)


CREATE TABLE "Toss_Decision" (
	"Toss_Id" INTEGER -- example: ['2', '1'],
	"Toss_Name" TEXT -- example: ['bat', 'field'],
	PRIMARY KEY ("Toss_Id")
)


CREATE TABLE "Umpire" (
	"Umpire_Id" INTEGER -- example: ['2', '1'],
	"Umpire_Name" TEXT -- example: ['MR Benson', 'Asad Rauf'],
	"Umpire_Country" INTEGER -- example: ['6', '10'],
	PRIMARY KEY ("Umpire_Id"), 
	CONSTRAINT fk_umpire_country FOREIGN KEY("Umpire_Country") REFERENCES "Country" ("Country_Id")
)


CREATE TABLE "Venue" (
	"Venue_Id" INTEGER -- example: ['2', '1'],
	"Venue_Name" TEXT -- example: ['M Chinnaswamy Stadium', 'Punjab Cricket Association Stadium'],
	"City_Id" INTEGER -- example: ['2', '1'],
	PRIMARY KEY ("Venue_Id"), 
	CONSTRAINT fk_venue_city FOREIGN KEY("City_Id") REFERENCES "City" ("City_Id")
)


CREATE TABLE "Wicket_Taken" (
	"Match_Id" INTEGER -- example: ['335988', '335987'],
	"Over_Id" INTEGER -- example: ['2', '3'],
	"Ball_Id" INTEGER -- example: ['2', '1'],
	"Player_Out" INTEGER -- example: ['8', '6'],
	"Kind_Out" INTEGER -- example: ['2', '1'],
	"Fielders" INTEGER -- example: ['9', '83'],
	"Innings_No" INTEGER -- example: ['2', '1'],
	PRIMARY KEY ("Match_Id", "Over_Id", "Ball_Id", "Innings_No"), 
	CONSTRAINT fk_wicket_taken_match FOREIGN KEY("Match_Id") REFERENCES "Match" ("Match_Id"),
	CONSTRAINT fk_wicket_taken_player FOREIGN KEY("Player_Out") REFERENCES "Player" ("Player_Id"),
	CONSTRAINT fk_wicket_taken_out_type FOREIGN KEY("Kind_Out") REFERENCES "Out_Type" ("Out_Id"),
	CONSTRAINT fk_wicket_taken_player FOREIGN KEY("Fielders") REFERENCES "Player" ("Player_Id")
)


CREATE TABLE "Win_By" (
	"Win_Id" INTEGER -- example: ['2', '1'],
	"Win_Type" TEXT -- example: ['runs', 'wickets'],
	PRIMARY KEY ("Win_Id")
)

Question: Which team did CK Kapugedera belong to? How many matches did he play?
Evidence: team refers to Team_Name; CK Kapugedera refers to Player_Name = 'CK Kapugedera'

SQL:
SELECT T3.Team_Name, COUNT(T2.Match_Id) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T1.Player_Name = 'CK Kapugedera'