Access
Excel and Access are very similar when it comes to running powerful queries, running sophisticated calculations, generating reports and forms, and connecting to external data.
Access
Access is a data management system with relational data.
Excel stores information in worksheets; Access stores data in tables for complex querying in relation to data stored in other locations.
Access
Access is a data management system with relational data.
Excel stores information in worksheets; Access stores data in tables for complex querying in relation to data stored in other locations.
- Require non-relational view of data (especially if data is mostly numeric)
- Want to run calculations and statistical comparisons
- Dataset is manageable in size (<=15,000 rows)
- Require relational database - May need to add more tables in future - Have a very large amount of data - Have a lot of data that is mostly text - Want to run complex queries - Need to maintain connectivity to external
databases
Access Interface
Select the view of your table or query (Datasheet, PivotTable, PivotChart, Design)
Create a new query
Navigate-to and filter tables, queries, forms, and reports
Retrieve, export or connect-to data outside of Access
Access Query Design
Run/execute the query
Fields and calculations in resulting query
You can write the query in SQL, but the Design View is a graphical user interface (GUI) that requires no knowledge of SQL language.
Select fields to display and perform calculations on + set relationships
Create new table or edit existing tables when query runs
Perform summary calculations (sum, count, average, etc.)
Access Query Design
Lines below “or:” are the Criteria for fields other than the first. Including different Criteria on the same horizontal line is the same as the “AND” Boolean; different Criteria on different horizontal lines is the same as the “OR” Boolean
Field: Field from existing table to be queried Table: Table where selected field exists Total: When Σ Totals is selected, can perform summary calculations (min, max, avg, etc.); default is “Group By” Sort: Ascending, Descending, or not sorted Show: Field will be displayed in query result if checked Criteria: Query for that field Or: Same as “OR” Boolean
Access Query Design
1
2
In the Show Table, select AREA_FAR, buildingclass, LOCATION and USE. Double-click to add each table to the query design.
Access Setting Relationships
Every table should have a unique identifier (the Primary Key, which is the BBL in our case for most tables).
You can relate to other tables by dragging one identifying field to another (BBL to BBL, BLDGCLASS TO BLDGCLASS).
Access Query Design
1. Double click each of the fields shown above to add them to query.
2. Select Σ Totals 3. Uncheck Show for BLDGCLASS and in the Criteria set it to LIKE ‘I*’
4. Under the Total dropdown, select Sum for LOTAREA and BLDGAREA and Sort the LOTAREA by Descending
1
2
3 4
5. Select Run
5
Access LIKE Statement
LIKE ‘I*’ selects anything that begins with “I”
LIKE ‘*I’ selects anything that ends with “I”
LIKE ‘*I*’ selects anything with an “I” in it
Selecting the View returns back to the Query Design
Access Query Design
1. Back in Design View, change the BLDGCLASS Criteria to ‘I1’ to list only Hospitals, Sanitariums, Mental Institutions
1
3
2. Save the query
2
3. Click Run
Access Updating Records
Oftentimes there are multiple spellings for the same owner. Selecting one name and replacing the others with the correct name can be accomplished via a query.
TIP: Save a copy of the database before making
updates.
Access Updating Records
1. Create a new query (Create > Query Design) and add the Location table
2
3
2. Double-click OWNERNAME and in the Criteria enter LIKE ‘*PRESBYTERIAN H*’ in one row; LIKE ‘*PRESPYTERIAN H*’ in another
1
3. Click Run
Access Updating Records
4. Select Update table
5
6 + 7
5. After removing the *, in the Update To row type in PRESBYTERIAN HOSPITAL
4
6. Click Run 7. A dialog will appear to confirm the update. Click Yes
Access Updating Records
Updating the table for Columbia University properties
LIKE ‘*COLUMBIA U*’ LIKE ‘*ROYAL CHARTER*’
Access Updating Records
Updating the table for Memorial Sloan-Kettering Cancer Center properties
LIKE ‘*S.K.I.*’ LIKE ‘*SLOAN-KETT*’ LIKE ‘*MEMORIAL HOSP*’ LIKE ‘*SKI REAL*’
Access Updating Records
Updating the table for St. Luke’s-Roosevelt Hospital properties.
LIKE “*ST LUKE’S/R*” LIKE ‘*ST LUKES-R*’ LIKE ‘*LUKES H*’
Access Complex Queries/Builder
1. Create a new query
2. Add LOCATION, AREA_FAR, and USE
3. Select OWNERNAME, BLDGCLASS
4. Create an Expression using Builder
4
Access Complex Queries/Builder
1. Navigate to your database and select the table(s) that contain the fields for the calculation (AREA_FAR)
2. Double-click on the desired Expression Categories to form an expression for the available built floor area; set the Criteria to >0
1 2
Access Complex Queries/Builder
To determine where the developable parcels are, return to Design View and add the BBL and ADDRESS
Access Complex Queries/Builder
1. Back in Design View, select Make Table
2. Enter a Table Name and click OK
1
3. Click Run to add the table to the database
3
2
Access Relating to GIS
1. Add Manhattan Tax Lots 2011 data to a new ArcMap document
2. Navigate to ArcCatalog and select Add OLE DB Connection under Database Connections
1
2
2
Access Relating to GIS
1. Under the Provider tab, select Microsoft Office 12.0 Access Database Engine OLE DB Provider
2. Click Next
1
2
Access Relating to GIS
1. Enter the location of the Access database in the Data Source field
2. Click Test Connection to verify that you can connect to the database
3. Click OK if the connection was successful
1
2
3
Access Relating to GIS
Navigate to the database in ArcCatalog and add the HOSP_OPP table to the document (drag and drop into the Table of Contents).
Access Relating to GIS
2. Make a copy of the Manhattan tax lots data (right click to copy, paste into Layers)
3. Join the HOSP_OPP table to the copied layer on BBL
1
2
Access GIS to Google Earth
1. Select the Layer To KML tool under ArcToolbox > Conversion Tools > To KML
2. Select the new layer and designate the output file; set the output scale to 1
3. Click OK
1
2
3
Access GIS to Google Earth
File > Open > navigate to the recently-created KMZ file
Google Earth will maintain symbology and data descriptions from ArcMap