What are the arriving date and the departing date of the dogs who have gone through a treatment?
create table dogs (date_arrived varchar, date_departed varchar, dog_id varchar, PRIMARY KEY (date_arrived)); create table treatments (dog_id varchar, PRIMARY KEY (dog_id))
select distinct t1.date_arrived, t1.date_departed from dogs as t1 join treatments as t2 on t1.dog_id = t2.dog_id