Write a program within embedded SQL to associative the total trip expenses of the salesman named ‘John' for the relations.
EXEC SQL BEGIN DECLARE SECTION;
long total_expenses;
EXEC SQL END DECLARE SECTION;
EXEC SQL
SELECT SUM(AMOUNT) INTO :total_expenses FROM EXPENSE WHERE TRIPID
IN (SELECT TRIP_ID FROM TRIP
WHERE SSN = (SELECT SSN FROM SALEPERSON WHERE NAME = ‘John'));
printf("\nThe total trip expenses of the salesman John is: %ld", total_expenses);