CREATE TABLE affiliated_with (physician DECIMAL, department DECIMAL, primaryaffiliation BOOLEAN)
CREATE TABLE medication (code DECIMAL, name TEXT, brand TEXT, description TEXT)
CREATE TABLE trained_in (physician DECIMAL, treatment DECIMAL, certificationdate TIME, certificationexpires TIME)
CREATE TABLE block (blockfloor DECIMAL, blockcode DECIMAL)
CREATE TABLE department (departmentid DECIMAL, name TEXT, head DECIMAL)
CREATE TABLE physician (employeeid DECIMAL, name TEXT, position TEXT, ssn DECIMAL)
CREATE TABLE stay (stayid DECIMAL, patient DECIMAL, room DECIMAL, staystart TIME, stayend TIME)
CREATE TABLE procedures (code DECIMAL, name TEXT, cost DECIMAL)
CREATE TABLE prescribes (physician DECIMAL, patient DECIMAL, medication DECIMAL, date TIME, appointment DECIMAL, dose TEXT)
CREATE TABLE on_call (nurse DECIMAL, blockfloor DECIMAL, blockcode DECIMAL, oncallstart TIME, oncallend TIME)
CREATE TABLE nurse (employeeid DECIMAL, name TEXT, position TEXT, registered BOOLEAN, ssn DECIMAL)
CREATE TABLE patient (ssn DECIMAL, name TEXT, address TEXT, phone TEXT, insuranceid DECIMAL, pcp DECIMAL)
CREATE TABLE appointment (appointmentid DECIMAL, patient DECIMAL, prepnurse DECIMAL, physician DECIMAL, start TIME, end TIME, examinationroom TEXT)
CREATE TABLE undergoes (patient DECIMAL, procedures DECIMAL, stay DECIMAL, dateundergoes TIME, physician DECIMAL, assistingnurse DECIMAL)
CREATE TABLE room (roomnumber DECIMAL, roomtype TEXT, blockfloor DECIMAL, blockcode DECIMAL, unavailable BOOLEAN)

What are the names of departments that have primarily affiliated physicians.
SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE primaryaffiliation = 1
SELECT DISTINCT "T2"."name" FROM "affiliated_with" AS "T1" JOIN "department" AS "T2" ON "T1"."department" = "T2"."departmentid" WHERE "primaryaffiliation" = 1