update messages_folders set folder_name = :name where folder_id = :folder_id delete from messages_folders where folder_id = :folder_id update messages_user_messages set folder_id = :folder_id_inbox where folder_id = :folder_id and user_id = :user_id