If statements in SQL
To have a conditional statement in a SELECT statement, use CASE WHEN…THEN….ELSE.
create view logbook as
select "Date",
"N Number",
"From","To",
"Number of Instrument Approaches",
"Number of Night Landings",
"Total Flight Duration" - "Night" as "Day",
"Night",
"Simulator",
"Simulated Instrument",
"Actual Instrument",
case when "IsCrossCountry" = true then "Total Flight Duration" else 0.0 end as "Cross Country"
from flights;