user: Question: When did the king who entered office in 1012 leave office?
Columns: ['Throne Name', 'Title', 'Born-Died', 'Entered office', 'Left office', 'Family Relations']
Types: ['text', 'text', 'text', 'text', 'text', 'text']
Sample row: ['Diylamids of Fars (933–1062)', 'Diylamids of Fars (933–1062)', 'Diylamids of Fars (933–1062)', 'Diylamids of Fars (933–1062)', 'Diylamids of Fars (933–1062)', 'Diylamids of Fars (933–1062)']
SQL:

assistant: SELECT "Left office" FROM "Table" WHERE "Entered office" = '1012';