City functions
City superlative
Other states of China (demo)
City lowest level
(Limit the city of the task to this level)
Database
Database fields
Use
Location City: state-City. Name, Data_level,
Derive the popular: number of searches. China-China +1; Guangzhou-Guangzhou +1;
Import data
Manually import major cities in China, major cities in the Americas
At last
Consider how to automatically import
Database relationships
City Table Relationship
Self-join foreign key relationships
Relationship between recruit and city table
Many-to-many
Passing to the front end
Tree structures in domestic and other states
Resident City
Many-to-many
Mission City
Many-to-many
Search process
Single City
- Incoming city= China
- Search City = City.object.filter (city= ' China ')
- Expand city to the lowest level, here for all cities in China
- Search for tasks that contain the city
Multiple cities
- Incoming city= China | Japan
- Find out China, Japan
- Expand China, Japan to a set inside
- The mission that contains the city
Urban Database design Process