Altering the Owner of All Tables in PostgreSQL

You can alter the owner of multiple tables at once by scripting PL/pgSQL

alter database :database owner to :owner;
do $$ declare t text; begin
    for t in select table_name
                from information_schema.tables
                where table_schema = :schema
                    and table_catalog = :database
        execute format(
                'alter table ' || :database || '.' || :schema
                    || '.%s owner to ' || :owner
            ), t
    end loop;
end $$;

Challenge #12

This week's challenge was reported to have been asked in interviews at Amazon

I've never been asked this kind of question. I've never interviewed at Amazon though. If that's the kind of question you are going to ask, let me go ahead and give you an answer ahead of time. Discussion, (Javascript), (Ruby) -- Yes even as an experienced programmer I still use CodeAcadamy for fun and practice. You should too, just not the paid version.