Added sql for the viewed copy table