Database schema:

CREATE TABLE businesses (
	business_id INTEGER NOT NULL -- example: ['24', '10'],
	name TEXT NOT NULL -- example: ['OMNI S.F. Hotel - 2nd Floor Pantry', 'Tiramisu Kitchen'],
	address TEXT DEFAULT NULL -- example: ['500 California St, 2nd  Floor', '033 Belden Pl'],
	city TEXT DEFAULT NULL -- example: ['San Francisco', 'S.F.'],
	postal_code TEXT DEFAULT NULL -- example: ['94133', '94104'],
	latitude REAL DEFAULT NULL -- example: ['37.7929', '37.7911'],
	longitude REAL DEFAULT NULL -- example: ['-122.403', '-122.404'],
	phone_number INTEGER DEFAULT NULL -- example: ['14155823535', '14155345060'],
	tax_code TEXT DEFAULT NULL -- example: ['H01', 'H24'],
	business_certificate INTEGER NOT NULL -- example: ['352312', '779059'],
	application_date DATE DEFAULT NULL -- example: ['2001-10-10', '1989-02-01'],
	owner_name TEXT NOT NULL -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp'],
	owner_address TEXT DEFAULT NULL -- example: ['500 California St, 2nd Floor', '33 Belden St'],
	owner_city TEXT DEFAULT NULL -- example: ['San Francisco', 'S.F.'],
	owner_state TEXT DEFAULT NULL -- example: ['DC', 'CA'],
	owner_zip TEXT DEFAULT NULL -- example: ['94133', '94104'],
	PRIMARY KEY (business_id)
)


CREATE TABLE inspections (
	business_id INTEGER NOT NULL -- example: ['24', '10'],
	score INTEGER DEFAULT NULL -- example: ['92', '94'],
	date DATE NOT NULL -- example: ['2014-01-14', '2014-01-24'],
	type TEXT NOT NULL -- example: ['Reinspection/Followup', 'Routine - Unscheduled'],
	CONSTRAINT fk_inspections_businesses FOREIGN KEY(business_id) REFERENCES businesses (business_id)
)


CREATE TABLE violations (
	business_id INTEGER NOT NULL -- example: ['24', '10'],
	date DATE NOT NULL -- example: ['2014-01-14', '2014-07-29'],
	violation_type_id TEXT NOT NULL -- example: ['103129', '103144'],
	risk_category TEXT NOT NULL -- example: ['Moderate Risk', 'Low Risk'],
	description TEXT NOT NULL -- example: ['Unapproved or unmaintained equipment or utensils', 'Insufficient hot water or running water'],
	CONSTRAINT fk_violations_businesses FOREIGN KEY(business_id) REFERENCES businesses (business_id)
)

Question: How many high risk violations do the restaurants in San Francisco have in total?
Evidence: restaurants in San Francisco refer to business_id where city in ('San Francisco', 'SF', 'S.F.', 'SAN FRANCISCO'); high risk violations refer to risk_category = 'High Risk';

SQL:
SELECT COUNT(T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.city IN ('San Francisco', 'SF', 'S.F.', 'SAN FRANCISCO') AND T1.risk_category = 'High Risk'