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: What percentage of the violations for "Melody Lounge" are moderate risks?
Evidence: DIVIDE(COUNT(risk_category = 'Moderate Risk' where name = 'Melody Lounge'), COUNT(business_id where name = 'Melody Lounge')) as percentage;

SQL:
SELECT CAST(SUM(CASE WHEN T2.risk_category = 'Moderate Risk' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM businesses AS T1 INNER JOIN violations AS T2 ON T1.business_id = T2.business_id WHERE T1.name = 'Melody Lounge'