SELECT state FROM Owners INTERSECT SELECT state FROM Professionals
Find the states where both owners and professionals live.
CREATE TABLE `Breeds` (
`breed_code` VARCHAR(10) PRIMARY KEY ,
`breed_name` VARCHAR(80)
);
CREATE TABLE `Charges` (
`charge_id` INTEGER PRIMARY KEY ,
`charge_type` VARCHAR(10),
`charge_amount` DECIMAL(19,4)
);
CREATE TABLE `Sizes` (
`size_code` VARCHAR(10) PRIMARY KEY ,
`size_description` VARCHAR(80)
);
CREATE TABLE `Treatment_Types` (
`treatment_type_code` VARCHAR(10) PRIMARY KEY ,
`treatment_type_description` VARCHAR(80)
);
CREATE TABLE `Owners` (
`owner_id` INTEGER PRIMARY KEY ,
`first_name` VARCHAR(50),
`last_name` VARCHAR(50),
`street` VARCHAR(50),
`city` VARCHAR(50),
`state` VARCHAR(20),
`zip_code` VARCHAR(20),
`email_address` VARCHAR(50),
`home_phone` VARCHAR(20),
`cell_number` VARCHAR(20)
);
CREATE TABLE `Dogs` (
`dog_id` INTEGER PRIMARY KEY ,
`owner_id` INTEGER NOT NULL,
`abandoned_yn` VARCHAR(1),
`breed_code` VARCHAR(10) NOT NULL,
`size_code` VARCHAR(10) NOT NULL,
`name` VARCHAR(50),
`age` VARCHAR(20),
`date_of_birth` DATETIME,
`gender` VARCHAR(1),
`weight` VARCHAR(20),
`date_arrived` DATETIME,
`date_adopted` DATETIME,
`date_departed` DATETIME,
FOREIGN KEY (`breed_code` ) REFERENCES `Breeds`(`breed_code` ),
FOREIGN KEY (`size_code` ) REFERENCES `Sizes`(`size_code` ),
FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` ),
FOREIGN KEY (`owner_id` ) REFERENCES `Owners`(`owner_id` )
);
CREATE TABLE `Professionals` (
`professional_id` INTEGER PRIMARY KEY ,
`role_code` VARCHAR(10) NOT NULL,
`first_name` VARCHAR(50),
`street` VARCHAR(50),
`city` VARCHAR(50),
`state` VARCHAR(20),
`zip_code` VARCHAR(20),
`last_name` VARCHAR(50),
`email_address` VARCHAR(50),
`home_phone` VARCHAR(20),
`cell_number` VARCHAR(20)
);
CREATE TABLE `Treatments` (
`treatment_id` INTEGER PRIMARY KEY ,
`dog_id` INTEGER NOT NULL,
`professional_id` INTEGER NOT NULL,
`treatment_type_code` VARCHAR(10) NOT NULL,
`date_of_treatment` DATETIME,
`cost_of_treatment` DECIMAL(19,4),
FOREIGN KEY (`treatment_type_code` ) REFERENCES `Treatment_Types`(`treatment_type_code` ),
FOREIGN KEY (`professional_id` ) REFERENCES `Professionals`(`professional_id` ),
FOREIGN KEY (`dog_id` ) REFERENCES `Dogs`(`dog_id` )
);
INSERT INTO Breeds (`breed_code`, `breed_name`) VALUES ('ESK', 'Eskimo');
INSERT INTO Charges (`charge_id`, `charge_type`, `charge_amount`) VALUES (1, 'Daily Accommodation', '98.0000');
INSERT INTO Sizes (`size_code`, `size_description`) VALUES ('SML', 'Small');
INSERT INTO Treatment_Types (`treatment_type_code`, `treatment_type_description`) VALUES ('EXAM', 'Physical examination');
INSERT INTO Owners (`owner_id`, `first_name`, `last_name`, `street`, `city`, `state`, `zip_code`, `email_address`, `home_phone`, `cell_number`) VALUES (1, 'Nora', 'Haley', '0647 Hintz Village Apt. 024', 'Lake Tia', 'Wisconsin', '93165', 'lynn81@example.org', '1-682-845-0116x63235', '478.978.0729');
INSERT INTO Dogs (`dog_id`, `owner_id`, `abandoned_yn`, `breed_code`, `size_code`, `name`, `age`, `date_of_birth`, `gender`, `weight`, `date_arrived`, `date_adopted`, `date_departed`) VALUES (1, 3, '1', 'ESK', 'LGE', 'Kacey', '6', '2012-01-27 05:11:53', '1', '7.57', '2017-09-08 20:10:13', '2018-03-06 16:32:11', '2018-03-25 06:58:44');
INSERT INTO Professionals (`professional_id`, `role_code`, `first_name`, `street`, `city`, `state`, `zip_code`, `last_name`, `email_address`, `home_phone`, `cell_number`) VALUES (1, 'Employee', 'Taryn', '6915 Oberbrunner Point Suite 491
INSERT INTO Treatments (`treatment_id`, `dog_id`, `professional_id`, `treatment_type_code`, `date_of_treatment`, `cost_of_treatment`) VALUES (1, 14, 9, 'WALK', '2018-03-19 04:39:54', '567.0000');