National Entity Master (Building Level)

Use the NCES database to download an Excel file of school buildings: http://nces.ed.gov/ccd/districtsearch/. A good example is the Florida file,

1.  Select the state

2.  Click the "Search" button

3.  Click the "Download Excel File" link

4.  Save the file as [State Code] Building Entity Master.xls

5.  Insert a new tab named “RawData”.

6.  Copy from source data A15: Control Shift End.

7.  Paste Special as values only into RawData A1.

8.  Insert 3 columns to the left of Column A.

9.  Field Names: ImpMunID, ImpCountyID, ImpScbID, ImpScbNCESCode, ImpScbBuildingCode, ImpMunNCESCode, ImpMunDOECode, LowGrade, HighGrade, BuildingName, DistrictName, CountyName, BuildingAddress, BuildingCity, ImpScbState, ImpScbPostalCode, ZIP 4-digit, ImpScbPhone, LocaleCode, Locale, Charter, Magnet, TitleISchool, Title1SchoolWide, Students, Teachers, StudentTeacherRatio, FreeLunch, ReducedLunch, ImpScbName, ImpScbAddress, ImpScbCity

10. Insert into Cell AD2: =Proper(J2) and paste to last row.

11. Insert into Cell AE2: =Proper(M2) and paste to last row

12. Insert into Cell AF2: =Proper(N2) and paste to last row

13. Insert XLSX file into MySQL aa_se_building_entity

14. Update the ImpMunID: UPDATE aa_se_building_entity JOIN m_municipalities ON MunDOECode = ImpMunDOECode SET ImpMunID = MunID WHERE MunModID = 2 AND MunState = 'FL' AND MunType = 'District'.

15. Check for missing MunID’s: SELECT * FROM aa_se_building_entity WHERE ImpMunID IS NULL

16. Update the County ID: UPDATE aa_se_building_entity JOIN m_municipalities ON MunName = CountyName SET ImpCountyID = MunID WHERE MunModID = 1 AND MunState = 'FL' AND MunType = 'County'.

17. Check for missing County ID’s: SELECT DISTINCT CountyName FROM aa_se_building_entity WHERE ImpCountyID IS NULL.

18. Update missing County ID’s (this is usually because of spelling differences. All counties should be in the m_municipalities table). This might help getting county names: UPDATE aa_se_building_entity SET CountyName = CONCAT(DistrictName,' ', 'County') WHERE ImpCountyID IS NULL

19. You may need to concatetnate the postal code: UPDATE aa_se_building_entity SET ImpScbPostalCode = CONCAT(ImpScbPostalCode,'-',`ZIP 4-digit`) WHERE `ZIP 4-digit` IS NOT NULL.

20. Insert the aa_se_building_entity table into the c_buildings table: INSERT INTO c_buildings (ScbScdID, ScbButID, ScbCountyID, ScbName, ScbBuildingCode, ScbNCESCode, ScbStatus, ScbCharter, ScbAddress, ScbCity, ScbState, ScbPostalCode, ScbDateAdded, ScbDateModified) SELECT ImpMunID, '1' AS BuildingType, ImpCountyID, ImpScbName, ImpScbBuildingCode, ImpScbNCESCode, 'Open-Active' AS ScbStatus, Charter, ImpScbAddress, ImpScbCity, ImpScbState, ImpScbPostalCode, NOW(), NOW() FROM aa_se_building_entity