Database schema:

CREATE TABLE actor (
	actor_id INTEGER -- example: ['2', '1'],
	first_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],
	last_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (actor_id)
)


CREATE TABLE address (
	address_id INTEGER -- example: ['2', '1'],
	address TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],
	address2 TEXT -- example: [''],
	district TEXT NOT NULL -- example: ['Alberta', 'QLD'],
	city_id INTEGER NOT NULL -- example: ['576', '300'],
	postal_code TEXT -- example: ['', '35200'],
	phone TEXT NOT NULL -- example: ['', '14033335568'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (address_id), 
	CONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)
)


CREATE TABLE category (
	category_id INTEGER -- example: ['2', '1'],
	name TEXT NOT NULL -- example: ['Animation', 'Action'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (category_id)
)


CREATE TABLE city (
	city_id INTEGER -- example: ['2', '1'],
	city TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],
	country_id INTEGER NOT NULL -- example: ['87', '82'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (city_id), 
	CONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)
)


CREATE TABLE country (
	country_id INTEGER -- example: ['2', '1'],
	country TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (country_id)
)


CREATE TABLE customer (
	customer_id INTEGER -- example: ['2', '1'],
	store_id INTEGER NOT NULL -- example: ['2', '1'],
	first_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],
	last_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],
	email TEXT -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org'],
	address_id INTEGER NOT NULL -- example: ['5', '6'],
	active INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],
	create_date DATETIME NOT NULL, 
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (customer_id), 
	CONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),
	CONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)
)


CREATE TABLE film (
	film_id INTEGER -- example: ['2', '1'],
	title TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],
	description TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],
	release_year TEXT -- example: ['2006'],
	language_id INTEGER NOT NULL -- example: ['1'],
	original_language_id INTEGER, 
	rental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],
	rental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],
	length INTEGER -- example: ['48', '86'],
	replacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],
	rating TEXT DEFAULT 'G' -- example: ['PG', 'G'],
	special_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (film_id), 
	CONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),
	CONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)
)


CREATE TABLE film_actor (
	actor_id INTEGER NOT NULL -- example: ['2', '1'],
	film_id INTEGER NOT NULL -- example: ['23', '1'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (actor_id, film_id), 
	CONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),
	CONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)
)


CREATE TABLE film_category (
	film_id INTEGER NOT NULL -- example: ['2', '1'],
	category_id INTEGER NOT NULL -- example: ['6', '11'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (film_id, category_id), 
	CONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),
	CONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)
)


CREATE TABLE film_text (
	film_id INTEGER NOT NULL -- example: ['2', '1'],
	title TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],
	description TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],
	PRIMARY KEY (film_id)
)


CREATE TABLE inventory (
	inventory_id INTEGER -- example: ['2', '1'],
	film_id INTEGER NOT NULL -- example: ['2', '1'],
	store_id INTEGER NOT NULL -- example: ['2', '1'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (inventory_id), 
	CONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),
	CONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)
)


CREATE TABLE language (
	language_id INTEGER -- example: ['2', '1'],
	name TEXT NOT NULL -- example: ['Italian', 'English'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (language_id)
)


CREATE TABLE payment (
	payment_id INTEGER -- example: ['2', '1'],
	customer_id INTEGER NOT NULL -- example: ['2', '1'],
	staff_id INTEGER NOT NULL -- example: ['2', '1'],
	rental_id INTEGER -- example: ['573', '76'],
	amount REAL NOT NULL -- example: ['2.99', '0.99'],
	payment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (payment_id), 
	CONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),
	CONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),
	CONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)
)


CREATE TABLE rental (
	rental_id INTEGER -- example: ['2', '1'],
	rental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],
	inventory_id INTEGER NOT NULL -- example: ['367', '1525'],
	customer_id INTEGER NOT NULL -- example: ['130', '459'],
	return_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],
	staff_id INTEGER NOT NULL -- example: ['2', '1'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (rental_id), 
	CONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),
	CONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),
	CONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),
	UNIQUE (rental_date, inventory_id, customer_id)
)


CREATE TABLE staff (
	staff_id INTEGER -- example: ['2', '1'],
	first_name TEXT NOT NULL -- example: ['Jon', 'Mike'],
	last_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],
	address_id INTEGER NOT NULL -- example: ['4', '3'],
	picture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],
	email TEXT -- example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com'],
	store_id INTEGER NOT NULL -- example: ['2', '1'],
	active INTEGER DEFAULT 1 NOT NULL -- example: ['1'],
	username TEXT NOT NULL -- example: ['Jon', 'Mike'],
	password TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (staff_id), 
	CONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),
	CONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)
)


CREATE TABLE store (
	store_id INTEGER -- example: ['2', '1'],
	manager_staff_id INTEGER NOT NULL -- example: ['2', '1'],
	address_id INTEGER NOT NULL -- example: ['2', '1'],
	last_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, 
	PRIMARY KEY (store_id), 
	CONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),
	CONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)
)

Question: Calculate customers' total payment amount in August, 2005.
Evidence: in August 2005 refers to payment_date like '2005-08%'; total payment amount refers to Sum(amount)

SQL:
SELECT SUM(amount) FROM payment WHERE SUBSTR(payment_date, 1, 7) = '2005-08'