All of the school districts of any county may be consolidated into a single school district embracing the entire county in the manner provided by § 59-17-20 for the alteration or division of school districts, and, whenever territory embraced in two or more counties is proposed to be formed into one school district, such district may be formed by the joint action of the boards of education of the respective counties as provided in § 59-17-20 for the formation of school districts in a county.