Database schema:

CREATE TABLE frpm (
	"CDSCode" TEXT NOT NULL -- example: ['01100170109835', '01100170112607'],
	"Academic Year" TEXT -- example: ['2014-2015'],
	"County Code" TEXT -- example: ['01', '02'],
	"District Code" INTEGER -- example: ['31609', '10017'],
	"School Code" TEXT -- example: ['0109835', '0112607'],
	"County Name" TEXT -- example: ['Alpine', 'Alameda'],
	"District Name" TEXT -- example: ['Alameda County Office of Education', 'California School for the Blind (State Special Sch'],
	"School Name" TEXT -- example: ['Envision Academy for Arts & Technology', 'FAME Public Charter'],
	"District Type" TEXT -- example: ['County Office of Education (COE)', 'State Special Schools'],
	"School Type" TEXT -- example: ['High Schools (Public)', 'K-12 Schools (Public)'],
	"Educational Option Type" TEXT -- example: ['Juvenile Court School', 'Traditional'],
	"NSLP Provision Status" TEXT -- example: ['Breakfast Provision 2', 'Provision 2'],
	"Charter School (Y/N)" INTEGER -- example: ['0', '1'],
	"Charter School Number" TEXT -- example: ['0728', '0811'],
	"Charter Funding Type" TEXT -- example: ['Locally funded', 'Directly funded'],
	"IRC" INTEGER -- example: ['0', '1'],
	"Low Grade" TEXT -- example: ['9', 'K'],
	"High Grade" TEXT -- example: ['8', '12'],
	"Enrollment (K-12)" REAL -- example: ['395.0', '1087.0'],
	"Free Meal Count (K-12)" REAL -- example: ['186.0', '565.0'],
	"Percent (%) Eligible Free (K-12)" REAL -- example: ['0.470886075949367', '0.519779208831647'],
	"FRPM Count (K-12)" REAL -- example: ['186.0', '715.0'],
	"Percent (%) Eligible FRPM (K-12)" REAL -- example: ['0.470886075949367', '0.657773689052438'],
	"Enrollment (Ages 5-17)" REAL -- example: ['1070.0', '376.0'],
	"Free Meal Count (Ages 5-17)" REAL -- example: ['182.0', '553.0'],
	"Percent (%) Eligible Free (Ages 5-17)" REAL -- example: ['0.484042553191489', '0.516822429906542'],
	"FRPM Count (Ages 5-17)" REAL -- example: ['182.0', '702.0'],
	"Percent (%) Eligible FRPM (Ages 5-17)" REAL -- example: ['0.484042553191489', '0.65607476635514'],
	"2013-14 CALPADS Fall 1 Certification Status" INTEGER -- example: ['1'],
	PRIMARY KEY ("CDSCode"), 
	CONSTRAINT fk_frpm_schools FOREIGN KEY("CDSCode") REFERENCES schools ("CDSCode")
)


CREATE TABLE satscores (
	cds TEXT NOT NULL -- example: ['10101080109991', '10101080000000'],
	rtype TEXT NOT NULL -- example: ['D', 'S'],
	sname TEXT -- school name, example: ['Envision Academy for Arts & Technology', 'FAME Public Charter'],
	dname TEXT -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'],
	cname TEXT -- county name, example: ['Alameda', 'Amador'],
	enroll12 INTEGER NOT NULL -- enrollment (1st-12nd grade), example: ['62', '398'],
	"NumTstTakr" INTEGER NOT NULL -- Number of Test Takers, example: ['17', '88'],
	"AvgScrRead" INTEGER -- average scores in Reading, example: ['503', '418'],
	"AvgScrMath" INTEGER -- average scores in Math, example: ['418', '546'],
	"AvgScrWrite" INTEGER -- average scores in writing, example: ['417', '505'],
	"NumGE1500" INTEGER -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: ['9', '14'],
	PRIMARY KEY (cds), 
	CONSTRAINT fk_satscores_schools FOREIGN KEY(cds) REFERENCES schools ("CDSCode")
)


CREATE TABLE schools (
	"CDSCode" TEXT NOT NULL -- example: ['01100170000000', '01100170109835'],
	"NCESDist" TEXT -- National Center for Educational Statistics school district identification number, example: ['0600002', '0691051'],
	"NCESSchool" TEXT -- National Center for Educational Statistics school identification number, example: ['10546', '10947'],
	"StatusType" TEXT NOT NULL -- example: ['Active', 'Closed'],
	"County" TEXT NOT NULL -- example: ['Alpine', 'Alameda'],
	"District" TEXT NOT NULL -- example: ['Alameda County Office of Education', 'California School for the Blind (State Special Sch'],
	"School" TEXT -- example: ['Envision Academy for Arts & Technology', 'FAME Public Charter'],
	"Street" TEXT -- example: ['39899 Balentine Drive, Suite 335', '313 West Winton Avenue'],
	"StreetAbr" TEXT -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'],
	"City" TEXT -- example: ['Newark', 'Hayward'],
	"Zip" TEXT -- example: ['94560-5359', '94544-1136'],
	"State" TEXT -- example: ['CA'],
	"MailStreet" TEXT -- Mail Street, example: ['39899 Balentine Drive, Suite 335', '313 West Winton Avenue'],
	"MailStrAbr" TEXT -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'],
	"MailCity" TEXT -- mailing city, example: ['Newark', 'Hayward'],
	"MailZip" TEXT -- mailing zip, example: ['94560-5359', '94544-1136'],
	"MailState" TEXT -- mailing state, example: ['CA'],
	"Phone" TEXT -- example: ['(510) 596-8901', '(510) 887-0152'],
	"Ext" TEXT -- extension, example: ['1240', '130'],
	"Website" TEXT -- example: ['www.acoe.org', 'www.envisionacademy.org/'],
	"OpenDate" DATE -- example: ['2006-08-28', '2005-08-29'],
	"ClosedDate" DATE -- example: ['2015-07-31', '2015-06-30'],
	"Charter" INTEGER -- example: ['0', '1'],
	"CharterNum" TEXT -- example: ['0728', '0811'],
	"FundingType" TEXT -- example: ['Locally funded', 'Directly funded'],
	"DOC" TEXT NOT NULL -- District Ownership Code, example: ['00', '31'],
	"DOCType" TEXT NOT NULL -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'],
	"SOC" TEXT -- School Ownership Code, example: ['65', '66'],
	"SOCType" TEXT -- School Ownership Code Type, example: ['High Schools (Public)', 'K-12 Schools (Public)'],
	"EdOpsCode" TEXT -- Education Option Code, example: ['JUV', 'TRAD'],
	"EdOpsName" TEXT -- Educational Option Name, example: ['Juvenile Court School', 'Traditional'],
	"EILCode" TEXT -- Educational Instruction Level Code, example: ['HS', 'ELEMHIGH'],
	"EILName" TEXT -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'],
	"GSoffered" TEXT -- grade span offered, example: ['K-12', '9-12'],
	"GSserved" TEXT -- grade span served., example: ['K-12', '9-12'],
	"Virtual" TEXT -- example: ['N', 'P'],
	"Magnet" INTEGER -- example: ['0', '1'],
	"Latitude" REAL -- example: ['37.658212', '37.521436'],
	"Longitude" REAL -- example: ['-121.99391', '-122.09713'],
	"AdmFName1" TEXT -- administrator's first name 1, example: ['Laura', 'L Karen'],
	"AdmLName1" TEXT -- administrator's last name 1, example: ['Monroe', 'Robell'],
	"AdmEmail1" TEXT -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'],
	"AdmFName2" TEXT -- administrator's first name 2, example: ['Jennifer', 'Sau-Lim (Lance)'],
	"AdmLName2" TEXT -- administrator's last name 2, example: ['Tsang', 'Koelling'],
	"AdmEmail2" TEXT -- administrator's email address 2, example: ['jkoelling@efcps.net', 'stsang@unityhigh.org'],
	"AdmFName3" TEXT -- administrator's first name 3, example: ['Drew', 'Irma'],
	"AdmLName3" TEXT -- administrator's last name 3, example: ['Sarratore', 'Munoz'],
	"AdmEmail3" TEXT -- administrator's email address 3, example: ['gmunoz@piedmont.k12.ca.us', 'dsarratore@vincentacademy.org'],
	"LastUpdate" DATE NOT NULL, 
	PRIMARY KEY ("CDSCode")
)

Question: Name schools in Riverside which the average of average math score for SAT is grater than 400, what is the funding type of these schools?
Evidence: Average of average math = sum(average math scores) / count(schools).

SQL:
SELECT T1.sname, T2.`Charter Funding Type` FROM satscores AS T1 INNER JOIN frpm AS T2 ON T1.cds = T2.CDSCode WHERE T2.`District Name` LIKE 'Riverside%' GROUP BY T1.sname, T2.`Charter Funding Type` HAVING CAST(SUM(T1.AvgScrMath) AS REAL) / COUNT(T1.cds) > 400