No, 'query optimizer fixes' only affects optimizer bug fixes that may result in unexpected query plan changes. It does not enable new features.
The only way to enable scalar function inlining is to set the database compatibility level to 150:
Enabling Scalar UDF Inlining
You can make workloads automatically eligible for Scalar UDF Inlining by ...
To have a realistic demo case, you need to populate the tables, not just create them.
Your title says "after deleting a row", but your trigger is clearly a "before" trigger.
If you (attempt to) delete a row from people which has no corresponding entry in accounts, then athleteSum naturally becomes NULL. What else would it do? If you wish to avoid this, ...
A very simple approach is this:
Make sure that you have common variables and parameters that will be passed to a certain function.
And simply call the function that you have made from other database.
ex. select [databasename].empstatus(empid) as status;
$conn=mysqli_connect($db_host, $db_user, $db_pass, $...