So I want to write a procedure to create a view, but only if a certain table exists. If it doesn't exist I don't want it to do anything. So something like this:
If table_X exists THEN CREATE VIEW table_X_view AS SELECT distance_start10 as distance_km, distance_end10 as distance_end_km FROM table_X
I've tried many different possibilities, but I just can't figure it out.