Database schema:

CREATE TABLE awards_coaches (
	id INTEGER -- example: ['2', '1'],
	year INTEGER -- example: ['1963', '1962'],
	"coachID" TEXT -- example: ['hannual01', 'gallaha01'],
	award TEXT -- example: ['NBA Coach of the Year', 'ABA Coach of the Year'],
	"lgID" TEXT -- example: ['NBA', 'ABA'],
	note TEXT -- example: ['tie'],
	PRIMARY KEY (id), 
	CONSTRAINT fk_awards_coaches_coaches FOREIGN KEY("coachID", year) REFERENCES coaches ("coachID", year)
)


CREATE TABLE awards_players (
	"playerID" TEXT NOT NULL -- example: ['abdulka01', 'abdulma02'],
	award TEXT NOT NULL -- example: ['All-NBA Second Team', 'All-Defensive Second Team'],
	year INTEGER NOT NULL -- example: ['1969', '1970'],
	"lgID" TEXT -- example: ['NBA', 'ABA'],
	note TEXT -- example: ['tie'],
	pos TEXT -- example: ['F', 'C'],
	PRIMARY KEY ("playerID", year, award), 
	CONSTRAINT fk_awards_players_players FOREIGN KEY("playerID") REFERENCES players ("playerID")
)


CREATE TABLE coaches (
	"coachID" TEXT NOT NULL -- example: ['adelmri01', 'adubari01'],
	year INTEGER NOT NULL -- example: ['1988', '1989'],
	"tmID" TEXT NOT NULL -- example: ['POR', 'GSW'],
	"lgID" TEXT -- example: ['NBA', 'ABA'],
	stint INTEGER NOT NULL -- example: ['2', '1'],
	won INTEGER -- example: ['59', '14'],
	lost INTEGER -- example: ['23', '21'],
	post_wins INTEGER -- example: ['0', '12'],
	post_losses INTEGER -- example: ['9', '3'],
	PRIMARY KEY ("coachID", year, "tmID", stint), 
	CONSTRAINT fk_coaches_teams FOREIGN KEY("tmID", year) REFERENCES teams ("tmID", year)
)


CREATE TABLE draft (
	id INTEGER DEFAULT 0 NOT NULL -- example: ['2', '1'],
	"draftYear" INTEGER -- example: ['1968', '1967'],
	"draftRound" INTEGER -- example: ['0', '1'],
	"draftSelection" INTEGER -- example: ['0', '3'],
	"draftOverall" INTEGER -- example: ['0', '3'],
	"tmID" TEXT -- example: ['DNR', 'ANA'],
	"firstName" TEXT -- example: ['Darrell', 'Bob'],
	"lastName" TEXT -- example: ['Krulish', 'Hardy'],
	"suffixName" TEXT -- example: ['Jr.'],
	"playerID" TEXT -- example: ['hardyda01', 'lewisbo01'],
	"draftFrom" TEXT -- example: ['Pacific', 'Baylor'],
	"lgID" TEXT -- example: ['NBA', 'ABA'],
	PRIMARY KEY (id), 
	CONSTRAINT fk_draft_teams FOREIGN KEY("tmID", "draftYear") REFERENCES teams ("tmID", year)
)


CREATE TABLE player_allstar (
	"playerID" TEXT NOT NULL -- example: ['abdulka01', 'abdursh01'],
	last_name TEXT -- example: ['Abdul-Jabbar', 'A-Rahim'],
	first_name TEXT -- example: ['Kareem', 'Shareef'],
	season_id INTEGER NOT NULL -- example: ['1969', '1970'],
	conference TEXT -- example: ['West', 'East'],
	league_id TEXT -- example: ['NBA', 'ABA'],
	games_played INTEGER -- example: ['1'],
	minutes INTEGER -- example: ['30', '18'],
	points INTEGER -- example: ['10', '19'],
	o_rebounds INTEGER -- example: ['2', '1'],
	d_rebounds INTEGER -- example: ['2', '5'],
	rebounds INTEGER -- example: ['14', '11'],
	assists INTEGER -- example: ['1', '4'],
	steals INTEGER -- example: ['0', '3'],
	blocks INTEGER -- example: ['2', '0'],
	turnovers INTEGER -- example: ['0', '1'],
	personal_fouls INTEGER -- example: ['2', '3'],
	fg_attempted INTEGER -- example: ['8', '16'],
	fg_made INTEGER -- example: ['8', '4'],
	ft_attempted INTEGER -- example: ['2', '4'],
	ft_made INTEGER -- example: ['2', '3'],
	three_attempted INTEGER -- example: ['0', '1'],
	three_made INTEGER -- example: ['0', '1'],
	PRIMARY KEY ("playerID", season_id), 
	CONSTRAINT fk_player_allstar_players FOREIGN KEY("playerID") REFERENCES players ("playerID")
)


CREATE TABLE players (
	"playerID" TEXT NOT NULL, 
	"useFirst" TEXT, 
	"firstName" TEXT, 
	"middleName" TEXT, 
	"lastName" TEXT, 
	"nameGiven" TEXT, 
	"fullGivenName" TEXT, 
	"nameSuffix" TEXT, 
	"nameNick" TEXT, 
	pos TEXT, 
	firstseason INTEGER, 
	lastseason INTEGER, 
	height REAL, 
	weight INTEGER, 
	college TEXT, 
	"collegeOther" TEXT, 
	"birthDate" DATE, 
	"birthCity" TEXT, 
	"birthState" TEXT, 
	"birthCountry" TEXT, 
	"highSchool" TEXT, 
	"hsCity" TEXT, 
	"hsState" TEXT, 
	"hsCountry" TEXT, 
	"deathDate" DATE, 
	race TEXT, 
	PRIMARY KEY ("playerID")
)


CREATE TABLE players_teams (
	id INTEGER -- example: ['2', '1'],
	"playerID" TEXT NOT NULL -- example: ['abdulka01', 'abdelal01'],
	year INTEGER -- example: ['1991', '1990'],
	stint INTEGER -- example: ['2', '1'],
	"tmID" TEXT -- example: ['POR', 'MIL'],
	"lgID" TEXT -- example: ['NBL', 'NBA'],
	"GP" INTEGER -- example: ['71', '43'],
	"GS" INTEGER -- example: ['0', '69'],
	minutes INTEGER -- example: ['934', '290'],
	points INTEGER -- example: ['432', '135'],
	"oRebounds" INTEGER -- example: ['81', '27'],
	"dRebounds" INTEGER -- example: ['62', '179'],
	rebounds INTEGER -- example: ['260', '89'],
	assists INTEGER -- example: ['30', '12'],
	steals INTEGER -- example: ['25', '4'],
	blocks INTEGER -- example: ['17', '12'],
	turnovers INTEGER -- example: ['22', '66'],
	"PF" INTEGER -- example: ['132', '39'],
	"fgAttempted" INTEGER -- example: ['116', '361'],
	"fgMade" INTEGER -- example: ['178', '55'],
	"ftAttempted" INTEGER -- example: ['44', '101'],
	"ftMade" INTEGER -- example: ['25', '76'],
	"threeAttempted" INTEGER -- example: ['0', '1'],
	"threeMade" INTEGER -- example: ['0', '1'],
	"PostGP" INTEGER -- example: ['5', '8'],
	"PostGS" INTEGER -- example: ['0', '6'],
	"PostMinutes" INTEGER -- example: ['25', '13'],
	"PostPoints" INTEGER -- example: ['4', '12'],
	"PostoRebounds" INTEGER -- example: ['0', '1'],
	"PostdRebounds" INTEGER -- example: ['2', '4'],
	"PostRebounds" INTEGER -- example: ['4', '3'],
	"PostAssists" INTEGER -- example: ['0', '2'],
	"PostSteals" INTEGER -- example: ['0', '20'],
	"PostBlocks" INTEGER -- example: ['0', '1'],
	"PostTurnovers" INTEGER -- example: ['0', '2'],
	"PostPF" INTEGER -- example: ['0', '4'],
	"PostfgAttempted" INTEGER -- example: ['6', '10'],
	"PostfgMade" INTEGER -- example: ['2', '5'],
	"PostftAttempted" INTEGER -- example: ['0', '4'],
	"PostftMade" INTEGER -- example: ['0', '2'],
	"PostthreeAttempted" INTEGER -- example: ['0', '1'],
	"PostthreeMade" INTEGER -- example: ['0', '12'],
	note TEXT -- example: ['C'],
	PRIMARY KEY (id), 
	CONSTRAINT fk_players_teams_teams FOREIGN KEY("tmID", year) REFERENCES teams ("tmID", year),
	CONSTRAINT fk_players_teams_players FOREIGN KEY("playerID") REFERENCES players ("playerID")
)


CREATE TABLE series_post (
	id INTEGER -- example: ['2', '1'],
	year INTEGER -- example: ['1947', '1946'],
	round TEXT -- example: ['QF', 'F'],
	series TEXT -- example: ['M', 'O'],
	"tmIDWinner" TEXT -- example: ['PHW', 'NYK'],
	"lgIDWinner" TEXT -- example: ['NBA', 'ABA'],
	"tmIDLoser" TEXT -- example: ['CLR', 'CHS'],
	"lgIDLoser" TEXT -- example: ['NBA', 'ABA'],
	"W" INTEGER -- example: ['2', '4'],
	"L" INTEGER -- example: ['0', '1'],
	PRIMARY KEY (id), 
	CONSTRAINT fk_series_post_teams FOREIGN KEY("tmIDWinner", year) REFERENCES teams ("tmID", year),
	CONSTRAINT fk_series_post_teams FOREIGN KEY("tmIDLoser", year) REFERENCES teams ("tmID", year)
)


CREATE TABLE teams (
	year INTEGER NOT NULL -- example: ['1937', '1938'],
	"lgID" TEXT -- example: ['NBL', 'NBA'],
	"tmID" TEXT NOT NULL -- example: ['AFS', 'AGW'],
	"franchID" TEXT -- example: ['AFS', 'AGW'],
	"confID" TEXT -- example: ['WC', 'EC'],
	"divID" TEXT -- example: ['WE', 'EA'],
	rank INTEGER -- example: ['2', '1'],
	"confRank" INTEGER -- example: ['0', '4'],
	playoff TEXT -- example: ['WC', 'CF'],
	name TEXT -- example: ['Akron Firestone Non-Skids', 'Akron Goodyear Wingfoots'],
	o_fgm INTEGER -- example: ['243', '249'],
	o_ftm INTEGER -- example: ['159', '183'],
	o_pts INTEGER -- example: ['681', '645'],
	d_pts INTEGER -- example: ['498', '578'],
	"homeWon" INTEGER -- example: ['2', '8'],
	"homeLost" INTEGER -- example: ['2', '1'],
	"awayWon" INTEGER -- example: ['5', '1'],
	"awayLost" INTEGER -- example: ['4', '3'],
	won INTEGER -- example: ['14', '13'],
	lost INTEGER -- example: ['5', '4'],
	games INTEGER -- example: ['9', '18'],
	arena TEXT -- example: ['Boston Garden', 'Chicago Stadium'],
	PRIMARY KEY (year, "tmID")
)

Question: Who is the longest serving coach from year 1970 to 1980. List the coach ID and the team(s) he served.
Evidence: 1970 to 1980 refers to year between 1970 and 1980; longest serving coach Max(Count(coachID)); team(s) he served refers to tmID

SQL:
SELECT coachID, tmID FROM coaches WHERE year BETWEEN 1970 AND 1980 ORDER BY stint DESC LIMIT 1