[INST] Here is a database schema:
frpm :
CDSCode [ TEXT ] primary_key frpm.CDSCode = schools.CDSCode
Academic Year [ TEXT ]
County Code [ TEXT ]
District Code [ INTEGER ]
School Code [ TEXT ]
County Name [ TEXT ]
District Name [ TEXT ]
School Name [ TEXT ]
District Type [ TEXT ]
School Type [ TEXT ]
Educational Option Type [ TEXT ]
NSLP Provision Status [ TEXT ]
Charter School (Y/N) [ INTEGER ]
Charter School Number [ TEXT ]
Charter Funding Type [ TEXT ]
IRC [ INTEGER ]
Low Grade [ TEXT ]
High Grade [ TEXT ]
Enrollment (K-12) [ REAL ]
Free Meal Count (K-12) [ REAL ]
Percent (%) Eligible Free (K-12) [ REAL ]
FRPM Count (K-12) [ REAL ]
Percent (%) Eligible FRPM (K-12) [ REAL ]
Enrollment (Ages 5-17) [ REAL ]
Free Meal Count (Ages 5-17) [ REAL ]
Percent (%) Eligible Free (Ages 5-17) [ REAL ]
FRPM Count (Ages 5-17) [ REAL ]
Percent (%) Eligible FRPM (Ages 5-17) [ REAL ]
2013-14 CALPADS Fall 1 Certification Status [ INTEGER ]

satscores :
cds [ TEXT ] primary_key satscores.cds = schools.CDSCode
rtype [ TEXT ]
sname [ TEXT ]
dname [ TEXT ]
cname [ TEXT ]
enroll12 [ INTEGER ]
NumTstTakr [ INTEGER ]
AvgScrRead [ INTEGER ]
AvgScrMath [ INTEGER ]
AvgScrWrite [ INTEGER ]
NumGE1500 [ INTEGER ]

schools :
CDSCode [ TEXT ] primary_key
NCESDist [ TEXT ]
NCESSchool [ TEXT ]
StatusType [ TEXT ]
County [ TEXT ]
District [ TEXT ]
School [ TEXT ]
Street [ TEXT ]
StreetAbr [ TEXT ]
City [ TEXT ]
Zip [ TEXT ]
State [ TEXT ]
MailStreet [ TEXT ]
MailStrAbr [ TEXT ]
MailCity [ TEXT ]
MailZip [ TEXT ]
MailState [ TEXT ]
Phone [ TEXT ]
Ext [ TEXT ]
Website [ TEXT ]
OpenDate [ DATE ]
ClosedDate [ DATE ]
Charter [ INTEGER ]
CharterNum [ TEXT ]
FundingType [ TEXT ]
DOC [ TEXT ]
DOCType [ TEXT ]
SOC [ TEXT ]
SOCType [ TEXT ]
EdOpsCode [ TEXT ]
EdOpsName [ TEXT ]
EILCode [ TEXT ]
EILName [ TEXT ]
GSoffered [ TEXT ]
GSserved [ TEXT ]
Virtual [ TEXT ]
Magnet [ INTEGER ]
Latitude [ REAL ]
Longitude [ REAL ]
AdmFName1 [ TEXT ]
AdmLName1 [ TEXT ]
AdmEmail1 [ TEXT ]
AdmFName2 [ TEXT ]
AdmLName2 [ TEXT ]
AdmEmail2 [ TEXT ]
AdmFName3 [ TEXT ]
AdmLName3 [ TEXT ]
AdmEmail3 [ TEXT ]
LastUpdate [ DATE ]

Please write me a SQL statement that answers the following question: What is the average score in writing for the schools that were opened after 1991 and closed before 2000? List the school names along with the score. Also, list the communication number of the schools if there is any. [/INST]
SELECT T2.School, T1.AvgScrWrite, T2.Phone FROM satscores AS T1 RIGHT JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE strftime('%Y', T2.OpenDate) >= 1991 OR strftime('%Y', T2.ClosedDate) < 2000;