Anonymous interview question

they ask pattern program and swap program and one sql subquery prograam