Database schema:

CREATE TABLE customers (
	"customerNumber" INTEGER NOT NULL -- example: ['112', '103'],
	"customerName" TEXT NOT NULL -- example: ['Signal Gift Stores', 'Atelier graphique'],
	"contactLastName" TEXT NOT NULL -- example: ['King', 'Schmitt'],
	"contactFirstName" TEXT NOT NULL -- example: ['Carine ', 'Jean'],
	phone TEXT NOT NULL -- example: ['40.32.2555', '7025551838'],
	"addressLine1" TEXT NOT NULL -- example: ['8489 Strong St.', '54, rue Royale'],
	"addressLine2" TEXT -- example: ['Level 3', 'Bronz Apt. 3/6 Tesvikiye'],
	city TEXT NOT NULL -- example: ['Nantes', 'Las Vegas'],
	state TEXT -- example: ['NV', 'Victoria'],
	"postalCode" TEXT -- example: ['83030', '44000'],
	country TEXT NOT NULL -- example: ['France', 'USA'],
	"salesRepEmployeeNumber" INTEGER -- example: ['1166', '1370'],
	"creditLimit" REAL -- example: ['21000.0', '71800.0'],
	PRIMARY KEY ("customerNumber"), 
	CONSTRAINT fk_customers_employees FOREIGN KEY("salesRepEmployeeNumber") REFERENCES employees ("employeeNumber")
)


CREATE TABLE employees (
	"employeeNumber" INTEGER NOT NULL -- example: ['1002', '1056'],
	"lastName" TEXT NOT NULL -- example: ['Patterson', 'Murphy'],
	"firstName" TEXT NOT NULL -- example: ['Diane', 'Mary'],
	extension TEXT NOT NULL -- example: ['x4611', 'x5800'],
	email TEXT NOT NULL -- example: ['mpatterso@classicmodelcars.com', 'dmurphy@classicmodelcars.com'],
	"officeCode" TEXT NOT NULL -- example: ['1', '6'],
	"reportsTo" INTEGER -- example: ['1002', '1056'],
	"jobTitle" TEXT NOT NULL -- example: ['President', 'VP Sales'],
	PRIMARY KEY ("employeeNumber"), 
	CONSTRAINT fk_employees_offices FOREIGN KEY("officeCode") REFERENCES offices ("officeCode"),
	CONSTRAINT fk_employees_employees FOREIGN KEY("reportsTo") REFERENCES employees ("employeeNumber")
)


CREATE TABLE offices (
	"officeCode" TEXT NOT NULL -- example: ['2', '1'],
	city TEXT NOT NULL -- example: ['Boston', 'San Francisco'],
	phone TEXT NOT NULL -- example: ['+1 215 837 0825', '+1 650 219 4782'],
	"addressLine1" TEXT NOT NULL -- example: ['100 Market Street', '1550 Court Place'],
	"addressLine2" TEXT -- example: ['Suite 300', 'Suite 102'],
	state TEXT -- example: ['MA', 'CA'],
	country TEXT NOT NULL -- example: ['USA', 'France'],
	"postalCode" TEXT NOT NULL -- example: ['02107', '94080'],
	territory TEXT NOT NULL -- example: ['EMEA', 'NA'],
	PRIMARY KEY ("officeCode")
)


CREATE TABLE orderdetails (
	"orderNumber" INTEGER NOT NULL -- example: ['10100', '10101'],
	"productCode" TEXT NOT NULL -- example: ['S18_1749', 'S18_2248'],
	"quantityOrdered" INTEGER NOT NULL -- example: ['30', '50'],
	"priceEach" REAL NOT NULL -- example: ['136.0', '55.09'],
	"orderLineNumber" INTEGER NOT NULL -- example: ['2', '3'],
	PRIMARY KEY ("orderNumber", "productCode"), 
	CONSTRAINT fk_orderdetails_products FOREIGN KEY("productCode") REFERENCES products ("productCode"),
	CONSTRAINT fk_orderdetails_orders FOREIGN KEY("orderNumber") REFERENCES orders ("orderNumber")
)


CREATE TABLE orders (
	"orderNumber" INTEGER NOT NULL -- example: ['10100', '10101'],
	"orderDate" DATE NOT NULL -- example: ['2003-01-06', '2003-01-09'],
	"requiredDate" DATE NOT NULL -- example: ['2003-01-13', '2003-01-18'],
	"shippedDate" DATE -- example: ['2003-01-11', '2003-01-10'],
	status TEXT NOT NULL -- example: ['Shipped', 'Resolved'],
	comments TEXT -- example: ['Check on availability.', 'Difficult to negotiate with customer. We need more'],
	"customerNumber" INTEGER NOT NULL -- example: ['128', '363'],
	PRIMARY KEY ("orderNumber"), 
	CONSTRAINT fk_orders_customers FOREIGN KEY("customerNumber") REFERENCES customers ("customerNumber")
)


CREATE TABLE payments (
	"customerNumber" INTEGER NOT NULL -- example: ['112', '103'],
	"checkNumber" TEXT NOT NULL -- example: ['JM555205', 'HQ336336'],
	"paymentDate" DATE NOT NULL -- example: ['2004-10-19', '2003-06-05'],
	amount REAL NOT NULL -- example: ['6066.78', '14571.44'],
	PRIMARY KEY ("customerNumber", "checkNumber"), 
	CONSTRAINT fk_payments_customers FOREIGN KEY("customerNumber") REFERENCES customers ("customerNumber")
)


CREATE TABLE productlines (
	"productLine" TEXT NOT NULL -- example: ['Classic Cars', 'Motorcycles'],
	"textDescription" TEXT -- example: ['Our motorcycles are state of the art replicas of c', 'Attention car enthusiasts: Make your wildest car o'],
	"htmlDescription" TEXT, 
	image BLOB, 
	PRIMARY KEY ("productLine")
)


CREATE TABLE products (
	"productCode" TEXT NOT NULL -- example: ['S10_1678', 'S10_1949'],
	"productName" TEXT NOT NULL -- example: ['1952 Alpine Renault 1300', '1969 Harley Davidson Ultimate Chopper'],
	"productLine" TEXT NOT NULL -- example: ['Classic Cars', 'Motorcycles'],
	"productScale" TEXT NOT NULL -- example: ['1:10', '1:12'],
	"productVendor" TEXT NOT NULL -- example: ['Min Lin Diecast', 'Classic Metal Creations'],
	"productDescription" TEXT NOT NULL -- example: ['This replica features working kickstand, front sus', 'Turnable front wheels; steering function; detailed'],
	"quantityInStock" INTEGER NOT NULL -- example: ['7305', '7933'],
	"buyPrice" REAL NOT NULL -- example: ['98.58', '48.81'],
	"MSRP" REAL NOT NULL -- example: ['214.3', '95.7'],
	PRIMARY KEY ("productCode"), 
	CONSTRAINT fk_products_productlines FOREIGN KEY("productLine") REFERENCES productlines ("productLine")
)

Question: Calculate the actual profit for order number 10100.
Evidence: SUM(MULTIPLY(quantityOrdered (SUBTRACT (priceEach, buyPrice));

SQL:
SELECT SUM((t1.priceEach - t2.buyPrice) * t1.quantityOrdered) FROM orderdetails AS t1 INNER JOIN products AS t2 ON t1.productCode = t2.productCode WHERE t1.orderNumber = '10100'