1. correlation
1.1 model class relationship
There are three types of relationships in relational databases:
- ForeignKey: one to many. Define the field in the multiple end.
- ManyToManyField: many to many, defining fields on either end.
- One to one field: one to one, define the field on either end.
1.1.1 one to many relationship
#Define book model class BookInfo class BookInfo(models.Model): btitle = models.CharField(max_length=20)#Title of book bpub_date = models.DateField()#Release date bread = models.IntegerField(default=0)#Reading volume bcomment = models.IntegerField(default=0)#Comment quantity isDelete = models.BooleanField(default=False)#Logical deletion #Define role model class RoleInfo class RoleInfo(models.Model): rname = models.CharField(max_length=20)#Role name rgender = models.BooleanField(default=True)#Role gender isDelete = models.BooleanField(default=False)#Logical deletion rcomment = models.CharField(max_len The relationship between role and library table is one to many, so the attribute is defined in role model class
1.1.2 many to many relationship
Let's design a news type and a news type. A news type can use many pieces of news, and a news can also belong to a variety of news types.
class TypeInfo(models.Model): tname = models.CharField(max_length=20) #News category class NewsInfo(models.Model): ntitle = models.CharField(max_length=60) #News headlines ncontent = models.TextField() #News content npub_date = models.DateTimeField(auto_now_add=True) #Press release time ntype = models.ManyToManyField('TypeInfo') #adopt ManyToManyField establish TypeInfo Class sum NewsInfo Many to many relationship between classes
1.2 associated query
Similar to join queries can be implemented in Django.
1.2.1 perform associated query by object
When defining model classes, you can specify three kinds of association relationships, the most commonly used one to many relationship, for example, "Book role" is one to many relationship.
#A corresponding model class object.Multiple corresponding model class names are lowercase_set b = BookInfo.objects.get(id=1) b.heroinfo_set.all()
Access syntax from many to one:
#Multiple corresponding model class objects.Attribute names of relation classes in multi corresponding model classes r = RoleInfo.objects.get(id=1) r.rbook
To access the id syntax of a corresponding model class association object:
#Multiple corresponding model class objects.Association class properties_id r = RoleInfo.objects.get(id=1) r.book_id
For example: query the book with number 1.
book=BookInfo.objects.get(pk=1)
Example: get all the roles of a book book book.
book.roleinfo_set.all()
Example: get the role with number 1.
role=RoleInfo.objects.get(pk=1)
Example: get the book from which the role comes.
role.rbook
1.2.2 perform associated query through model class
Querying one model class data from multiple model conditions:
The syntax is as follows:
Association model class name lowercase property name conditional operator = value
If there is no "uuuu operator" part, it means equal, and the result is the same as the inner join in sql.
For example: to query a book, the hero's description in the book is required to include 'Han'.
list = BookInfo.objects.filter(heroinfo__hcontent__contains='Han')
Querying multiple model class data from a model class condition:
The syntax is as follows:
A model associated attribute name, a model class attribute name, conditional conditional operator = value.
E.g.: inquire about all the heroes whose title is "Douluo land".
list = HeroInfo.objects.filter(hbook__btitle='Continent of')
1.3 self correlation
For regional information, classification information and other data, the table structure is very similar, and the amount of data in each table is very limited. In order to make full use of the data storage function of the data table, a table can be designed, and the internal relationship fields point to the primary key of this table, which is the self-correlation table structure.
Open the booktest/models.py file to define the AreaInfo class.
The relationship property uses self to point to this class, and null and blank are required to be allowed to be empty, because the primary data has no parent.
#Define regional model class to store Province, city, district and County Information class AreaInfo(models.Model): atitle=models.CharField(max_length=30)#Name aParent=models.ForeignKey('self',null=True,blank=True)#relationship
Migration.
python manage.py makemigrations
python manage.py migrate
Open mysql command line and import data.
areas.sqlINSERT INTO booktest_areainfo VALUES ('440000', 'Guangdong Province', NULL); INSERT INTO booktest_areainfo VALUES ('440100', 'Guangzhou City', '440000'); INSERT INTO booktest_areainfo VALUES ('440103', 'Liwan District', '440100'); INSERT INTO booktest_areainfo VALUES ('440104', 'Yuexiu District', '440100'); INSERT INTO booktest_areainfo VALUES ('440105', 'Haizhuqu District', '440100'); INSERT INTO booktest_areainfo VALUES ('440106', 'Tianhe District', '440100'); INSERT INTO booktest_areainfo VALUES ('440111', 'Baiyun District', '440100'); INSERT INTO booktest_areainfo VALUES ('440112', 'Whampoa District', '440100'); INSERT INTO booktest_areainfo VALUES ('440113', 'Panyu District', '440100'); INSERT INTO booktest_areainfo VALUES ('440114', 'Huadu District', '440100'); INSERT INTO booktest_areainfo VALUES ('440115', 'Nansha District', '440100'); INSERT INTO booktest_areainfo VALUES ('440116', 'Luogang District', '440100'); INSERT INTO booktest_areainfo VALUES ('440183', 'Zengcheng City', '440100'); INSERT INTO booktest_areainfo VALUES ('440184', 'Conghua', '440100'); INSERT INTO booktest_areainfo VALUES ('440200', 'Shaoguan City', '440000'); INSERT INTO booktest_areainfo VALUES ('440203', 'Wujiang District', '440200'); INSERT INTO booktest_areainfo VALUES ('440204', 'Zhenjiang District', '440200'); INSERT INTO booktest_areainfo VALUES ('440205', 'Qujiang District', '440200'); INSERT INTO booktest_areainfo VALUES ('440222', 'Shixing County', '440200'); INSERT INTO booktest_areainfo VALUES ('440224', 'Renhua county', '440200'); INSERT INTO booktest_areainfo VALUES ('440229', 'Wengyuan County', '440200'); INSERT INTO booktest_areainfo VALUES ('440232', 'Ruyuan Yao Autonomous County', '440200'); INSERT INTO booktest_areainfo VALUES ('440233', 'New Fengxian County', '440200'); INSERT INTO booktest_areainfo VALUES ('440281', 'Lechang City', '440200'); INSERT INTO booktest_areainfo VALUES ('440282', 'Nanxiong City', '440200'); INSERT INTO booktest_areainfo VALUES ('440300', 'Shenzhen City', '440000'); INSERT INTO booktest_areainfo VALUES ('440303', 'Luohu District', '440300'); INSERT INTO booktest_areainfo VALUES ('440304', 'Futian District', '440300'); INSERT INTO booktest_areainfo VALUES ('440305', 'Nanshan District', '440300'); INSERT INTO booktest_areainfo VALUES ('440306', 'Baoan District', '440300'); INSERT INTO booktest_areainfo VALUES ('440307', 'Longgang District', '440300'); INSERT INTO booktest_areainfo VALUES ('440308', 'Yantian District', '440300'); INSERT INTO booktest_areainfo VALUES ('440400', 'Zhuhai City', '440000'); INSERT INTO booktest_areainfo VALUES ('440402', 'Xiangzhou District', '440400'); INSERT INTO booktest_areainfo VALUES ('440403', 'Doumen District', '440400'); INSERT INTO booktest_areainfo VALUES ('440404', 'Jin Wan District', '440400'); INSERT INTO booktest_areainfo VALUES ('440500', 'Shantou City', '440000'); INSERT INTO booktest_areainfo VALUES ('440507', 'Longhu District', '440500'); INSERT INTO booktest_areainfo VALUES ('440511', 'Jinping District', '440500'); INSERT INTO booktest_areainfo VALUES ('440512', 'haojiang', '440500'); INSERT INTO booktest_areainfo VALUES ('440513', 'Chaoyang District', '440500'); INSERT INTO booktest_areainfo VALUES ('440514', 'Chaonan District', '440500'); INSERT INTO booktest_areainfo VALUES ('440515', 'Chenghai District', '440500'); INSERT INTO booktest_areainfo VALUES ('440523', 'Nan'ao County', '440500'); INSERT INTO booktest_areainfo VALUES ('440600', 'Foshan City', '440000'); INSERT INTO booktest_areainfo VALUES ('440604', 'Chancheng District', '440600'); INSERT INTO booktest_areainfo VALUES ('440605', 'Nanhai District', '440600'); INSERT INTO booktest_areainfo VALUES ('440606', 'Shunde District', '440600'); INSERT INTO booktest_areainfo VALUES ('440607', 'Sanshui District', '440600'); INSERT INTO booktest_areainfo VALUES ('440608', 'Gaoming District', '440600'); INSERT INTO booktest_areainfo VALUES ('440700', 'Jiangmen City', '440000'); INSERT INTO booktest_areainfo VALUES ('440703', 'Pengjiang District', '440700'); INSERT INTO booktest_areainfo VALUES ('440704', 'Jianghai District', '440700'); INSERT INTO booktest_areainfo VALUES ('440705', 'Xinhui District', '440700'); INSERT INTO booktest_areainfo VALUES ('440781', 'Taishan City', '440700'); INSERT INTO booktest_areainfo VALUES ('440783', 'Kaiping City', '440700'); INSERT INTO booktest_areainfo VALUES ('440784', 'Heshan City', '440700'); INSERT INTO booktest_areainfo VALUES ('440785', 'enping', '440700'); INSERT INTO booktest_areainfo VALUES ('440800', 'Zhanjiang City', '440000'); INSERT INTO booktest_areainfo VALUES ('440802', 'Chikan District', '440800'); INSERT INTO booktest_areainfo VALUES ('440803', 'Xiashan District', '440800'); INSERT INTO booktest_areainfo VALUES ('440804', 'Slope head area', '440800'); INSERT INTO booktest_areainfo VALUES ('440811', 'Mah District', '440800'); INSERT INTO booktest_areainfo VALUES ('440823', 'Suixi County', '440800'); INSERT INTO booktest_areainfo VALUES ('440825', 'Xuwen County', '440800'); INSERT INTO booktest_areainfo VALUES ('440881', 'Lianjiang City', '440800'); INSERT INTO booktest_areainfo VALUES ('440882', 'Leizhou City', '440800'); INSERT INTO booktest_areainfo VALUES ('440883', 'Wuchuan City', '440800'); INSERT INTO booktest_areainfo VALUES ('440900', 'Maoming City', '440000'); INSERT INTO booktest_areainfo VALUES ('440902', 'Maonan District', '440900'); INSERT INTO booktest_areainfo VALUES ('440903', 'Maogang District', '440900'); INSERT INTO booktest_areainfo VALUES ('440923', 'Dianbai County', '440900'); INSERT INTO booktest_areainfo VALUES ('440981', 'Gaozhou City', '440900'); INSERT INTO booktest_areainfo VALUES ('440982', 'Huazhou City', '440900'); INSERT INTO booktest_areainfo VALUES ('440983', 'Xinyi City', '440900'); INSERT INTO booktest_areainfo VALUES ('441200', 'Zhaoqing City', '440000'); INSERT INTO booktest_areainfo VALUES ('441202', 'Duanzhou District', '441200'); INSERT INTO booktest_areainfo VALUES ('441203', 'Dinghu District', '441200'); INSERT INTO booktest_areainfo VALUES ('441223', 'Guangning County', '441200'); INSERT INTO booktest_areainfo VALUES ('441224', 'Huaiji County', '441200'); INSERT INTO booktest_areainfo VALUES ('441225', 'Fengkai County', '441200'); INSERT INTO booktest_areainfo VALUES ('441226', 'Deqin County', '441200'); INSERT INTO booktest_areainfo VALUES ('441283', 'Gaoyao City', '441200'); INSERT INTO booktest_areainfo VALUES ('441284', 'Sihui City', '441200'); INSERT INTO booktest_areainfo VALUES ('441300', 'Huizhou City', '440000'); INSERT INTO booktest_areainfo VALUES ('441302', 'Huicheng District', '441300'); INSERT INTO booktest_areainfo VALUES ('441303', 'Huiyang District', '441300'); INSERT INTO booktest_areainfo VALUES ('441322', 'Boluo County', '441300'); INSERT INTO booktest_areainfo VALUES ('441323', 'Huidong County', '441300'); INSERT INTO booktest_areainfo VALUES ('441324', 'Longmen County', '441300'); INSERT INTO booktest_areainfo VALUES ('441400', 'Meizhou City', '440000'); INSERT INTO booktest_areainfo VALUES ('441402', 'Meijiang District', '441400'); INSERT INTO booktest_areainfo VALUES ('441421', 'Meixian', '441400'); INSERT INTO booktest_areainfo VALUES ('441422', 'Dapu County', '441400'); INSERT INTO booktest_areainfo VALUES ('441423', 'Fengshun County', '441400'); INSERT INTO booktest_areainfo VALUES ('441424', 'Wuhua County', '441400'); INSERT INTO booktest_areainfo VALUES ('441426', 'Pingyuan County', '441400'); INSERT INTO booktest_areainfo VALUES ('441427', 'Jiaoling County', '441400'); INSERT INTO booktest_areainfo VALUES ('441481', 'Xingning City', '441400'); INSERT INTO booktest_areainfo VALUES ('441500', 'Shanwei City', '440000'); INSERT INTO booktest_areainfo VALUES ('441502', 'City Proper', '441500'); INSERT INTO booktest_areainfo VALUES ('441521', 'Haifeng County', '441500'); INSERT INTO booktest_areainfo VALUES ('441523', 'Luhe County', '441500'); INSERT INTO booktest_areainfo VALUES ('441581', 'Lufeng City', '441500'); INSERT INTO booktest_areainfo VALUES ('441600', 'Heyuan City', '440000'); INSERT INTO booktest_areainfo VALUES ('441602', 'Yuan Cheng District', '441600'); INSERT INTO booktest_areainfo VALUES ('441621', 'Zijin County', '441600'); INSERT INTO booktest_areainfo VALUES ('441622', 'Longchuan County', '441600'); INSERT INTO booktest_areainfo VALUES ('441623', 'Lian Ping County', '441600'); INSERT INTO booktest_areainfo VALUES ('441624', 'Heping County', '441600'); INSERT INTO booktest_areainfo VALUES ('441625', 'Dongyuan County', '441600'); INSERT INTO booktest_areainfo VALUES ('441700', 'Yangjiang City', '440000'); INSERT INTO booktest_areainfo VALUES ('441702', 'Jiangcheng District', '441700'); INSERT INTO booktest_areainfo VALUES ('441721', 'Yangxi County', '441700'); INSERT INTO booktest_areainfo VALUES ('441723', 'Yangdong County', '441700'); INSERT INTO booktest_areainfo VALUES ('441781', 'Yangchun', '441700'); INSERT INTO booktest_areainfo VALUES ('441800', 'Qingyuan City', '440000'); INSERT INTO booktest_areainfo VALUES ('441802', 'Qingcheng District', '441800'); INSERT INTO booktest_areainfo VALUES ('441821', 'Fogang County', '441800'); INSERT INTO booktest_areainfo VALUES ('441823', 'Yangshan County', '441800'); INSERT INTO booktest_areainfo VALUES ('441825', 'Lianshan Zhuang Yao Autonomous County', '441800'); INSERT INTO booktest_areainfo VALUES ('441826', 'Liannan Yao Autonomous County', '441800'); INSERT INTO booktest_areainfo VALUES ('441827', 'Qingxin County', '441800'); INSERT INTO booktest_areainfo VALUES ('441881', 'Yingde', '441800'); INSERT INTO booktest_areainfo VALUES ('441882', 'Lianzhou City', '441800'); INSERT INTO booktest_areainfo VALUES ('441900', 'Dongguan City', '440000'); INSERT INTO booktest_areainfo VALUES ('442000', 'zhongshan', '440000'); INSERT INTO booktest_areainfo VALUES ('445100', 'Chaozhou City', '440000'); INSERT INTO booktest_areainfo VALUES ('445102', 'Xiangqiao District', '445100'); INSERT INTO booktest_areainfo VALUES ('445121', 'Chaoan District', '445100'); INSERT INTO booktest_areainfo VALUES ('445122', 'Raoping County', '445100'); INSERT INTO booktest_areainfo VALUES ('445200', 'Jieyang City', '440000'); INSERT INTO booktest_areainfo VALUES ('445202', 'Rongcheng District', '445200'); INSERT INTO booktest_areainfo VALUES ('445221', 'Jiedong County', '445200'); INSERT INTO booktest_areainfo VALUES ('445222', 'Jiexi County', '445200'); INSERT INTO booktest_areainfo VALUES ('445224', 'Huilai County', '445200'); INSERT INTO booktest_areainfo VALUES ('445281', 'Puning City', '445200'); INSERT INTO booktest_areainfo VALUES ('445300', 'Yunfu City', '440000'); INSERT INTO booktest_areainfo VALUES ('445302', 'Yuncheng district', '445300'); INSERT INTO booktest_areainfo VALUES ('445321', 'Xinxing County', '445300'); INSERT INTO booktest_areainfo VALUES ('445322', 'Yunan County', '445300'); INSERT INTO booktest_areainfo VALUES ('445323', 'Yun'an County', '445300'); INSERT INTO booktest_areainfo VALUES ('445381', 'Luoding', '445300'); INSERT INTO booktest_areainfo VALUES ('430000', 'Hunan Province', NULL); INSERT INTO booktest_areainfo VALUES ('430100', 'Changsha City', '430000'); INSERT INTO booktest_areainfo VALUES ('430102', 'Furong district', '430100'); INSERT INTO booktest_areainfo VALUES ('430103', 'Tianxin District', '430100'); INSERT INTO booktest_areainfo VALUES ('430104', 'Yuelu District', '430100'); INSERT INTO booktest_areainfo VALUES ('430105', 'Kaifu District', '430100'); INSERT INTO booktest_areainfo VALUES ('430111', 'Yuhua District', '430100'); INSERT INTO booktest_areainfo VALUES ('430121', 'Changsha County', '430100'); INSERT INTO booktest_areainfo VALUES ('430122', 'Wangcheng County', '430100'); INSERT INTO booktest_areainfo VALUES ('430124', 'Ningxiang County', '430100'); INSERT INTO booktest_areainfo VALUES ('430181', 'Liuyang City', '430100'); INSERT INTO booktest_areainfo VALUES ('430200', 'Zhuzhou City', '430000'); INSERT INTO booktest_areainfo VALUES ('430202', 'Lotus pond area', '430200'); INSERT INTO booktest_areainfo VALUES ('430203', 'Lu Song District', '430200'); INSERT INTO booktest_areainfo VALUES ('430204', 'Shifeng District', '430200'); INSERT INTO booktest_areainfo VALUES ('430211', 'Tianyuan District', '430200'); INSERT INTO booktest_areainfo VALUES ('430221', 'Zhuzhou County', '430200'); INSERT INTO booktest_areainfo VALUES ('430223', 'Youxian', '430200'); INSERT INTO booktest_areainfo VALUES ('430224', 'Chaling County', '430200'); INSERT INTO booktest_areainfo VALUES ('430225', 'Yanling County', '430200'); INSERT INTO booktest_areainfo VALUES ('430281', 'Liling City', '430200'); INSERT INTO booktest_areainfo VALUES ('430300', 'Xiangtan City', '430000'); INSERT INTO booktest_areainfo VALUES ('430302', 'Yuhu District', '430300'); INSERT INTO booktest_areainfo VALUES ('430304', 'Yue Tang District', '430300'); INSERT INTO booktest_areainfo VALUES ('430321', 'Xiangtan County', '430300'); INSERT INTO booktest_areainfo VALUES ('430381', 'Xiangxiang', '430300'); INSERT INTO booktest_areainfo VALUES ('430382', 'Shaoshan City', '430300'); INSERT INTO booktest_areainfo VALUES ('430400', 'Hengyang City', '430000'); INSERT INTO booktest_areainfo VALUES ('430405', 'Chu Hui District', '430400'); INSERT INTO booktest_areainfo VALUES ('430406', 'Yanfeng District', '430400'); INSERT INTO booktest_areainfo VALUES ('430407', 'Shigu District', '430400'); INSERT INTO booktest_areainfo VALUES ('430408', 'The Xiang River area', '430400'); INSERT INTO booktest_areainfo VALUES ('430412', 'Nanyue District', '430400'); INSERT INTO booktest_areainfo VALUES ('430421', 'Hengyang County', '430400'); INSERT INTO booktest_areainfo VALUES ('430422', 'Hengnan County', '430400'); INSERT INTO booktest_areainfo VALUES ('430423', 'Heng Mountain County', '430400'); INSERT INTO booktest_areainfo VALUES ('430424', 'Hengdong County', '430400'); INSERT INTO booktest_areainfo VALUES ('430426', 'Qidong County', '430400'); INSERT INTO booktest_areainfo VALUES ('430481', 'Leiyang City', '430400'); INSERT INTO booktest_areainfo VALUES ('430482', 'Changning City', '430400'); INSERT INTO booktest_areainfo VALUES ('430500', 'Shaoyang City', '430000'); INSERT INTO booktest_areainfo VALUES ('430502', 'Shuang Qing District', '430500'); INSERT INTO booktest_areainfo VALUES ('430503', 'Daxiang District', '430500'); INSERT INTO booktest_areainfo VALUES ('430511', 'North Tower area', '430500'); INSERT INTO booktest_areainfo VALUES ('430521', 'Shaodong County', '430500'); INSERT INTO booktest_areainfo VALUES ('430522', 'Xinshao County', '430500'); INSERT INTO booktest_areainfo VALUES ('430523', 'Shaoyang County', '430500'); INSERT INTO booktest_areainfo VALUES ('430524', 'Longhui County', '430500'); INSERT INTO booktest_areainfo VALUES ('430525', 'Dongkou County', '430500'); INSERT INTO booktest_areainfo VALUES ('430527', 'Suining County', '430500'); INSERT INTO booktest_areainfo VALUES ('430528', 'Xinning County', '430500'); INSERT INTO booktest_areainfo VALUES ('430529', 'Chengbu Miao Autonomous County', '430500'); INSERT INTO booktest_areainfo VALUES ('430581', 'Wugang City', '430500'); INSERT INTO booktest_areainfo VALUES ('430600', 'Yueyang City', '430000'); INSERT INTO booktest_areainfo VALUES ('430602', 'Yueyanglou District', '430600'); INSERT INTO booktest_areainfo VALUES ('430603', 'Yunxi District', '430600'); INSERT INTO booktest_areainfo VALUES ('430611', 'Junshan District', '430600'); INSERT INTO booktest_areainfo VALUES ('430621', 'Yueyang County', '430600'); INSERT INTO booktest_areainfo VALUES ('430623', 'Huarong County', '430600'); INSERT INTO booktest_areainfo VALUES ('430624', 'Xiangyin County', '430600'); INSERT INTO booktest_areainfo VALUES ('430626', 'Pingjiang County', '430600'); INSERT INTO booktest_areainfo VALUES ('430681', 'Miluo City', '430600'); INSERT INTO booktest_areainfo VALUES ('430682', 'Linxiang City', '430600'); INSERT INTO booktest_areainfo VALUES ('430700', 'Changde City', '430000'); INSERT INTO booktest_areainfo VALUES ('430702', 'Wuling District', '430700'); INSERT INTO booktest_areainfo VALUES ('430703', 'Dingcheng District', '430700'); INSERT INTO booktest_areainfo VALUES ('430721', 'Anxiang County', '430700'); INSERT INTO booktest_areainfo VALUES ('430722', 'Hanshou County', '430700'); INSERT INTO booktest_areainfo VALUES ('430723', 'Lixian', '430700'); INSERT INTO booktest_areainfo VALUES ('430724', 'Linli County', '430700'); INSERT INTO booktest_areainfo VALUES ('430725', 'Taoyuan County', '430700'); INSERT INTO booktest_areainfo VALUES ('430726', 'Shimenn County', '430700'); INSERT INTO booktest_areainfo VALUES ('430781', 'Jinshi City', '430700'); INSERT INTO booktest_areainfo VALUES ('430800', 'Zhangjiajie City', '430000'); INSERT INTO booktest_areainfo VALUES ('430802', 'Yongding District', '430800'); INSERT INTO booktest_areainfo VALUES ('430811', 'Wulingyuan District', '430800'); INSERT INTO booktest_areainfo VALUES ('430821', 'Cili County', '430800'); INSERT INTO booktest_areainfo VALUES ('430822', 'Sangzhi County', '430800'); INSERT INTO booktest_areainfo VALUES ('430900', 'Yiyang City', '430000'); INSERT INTO booktest_areainfo VALUES ('430902', 'Ziyang District', '430900'); INSERT INTO booktest_areainfo VALUES ('430903', 'Heshan District', '430900'); INSERT INTO booktest_areainfo VALUES ('430921', 'Nanxian', '430900'); INSERT INTO booktest_areainfo VALUES ('430922', 'Taojiang County', '430900'); INSERT INTO booktest_areainfo VALUES ('430923', 'Anhua County', '430900'); INSERT INTO booktest_areainfo VALUES ('430981', 'Yuanjiang City', '430900'); INSERT INTO booktest_areainfo VALUES ('431000', 'Chenzhou City', '430000'); INSERT INTO booktest_areainfo VALUES ('431002', 'Beihu District', '431000'); INSERT INTO booktest_areainfo VALUES ('431003', 'Suxian', '431000'); INSERT INTO booktest_areainfo VALUES ('431021', 'Guiyang County', '431000'); INSERT INTO booktest_areainfo VALUES ('431022', 'Yizhang County', '431000'); INSERT INTO booktest_areainfo VALUES ('431023', 'Yongxing County', '431000'); INSERT INTO booktest_areainfo VALUES ('431024', 'Jiahe County', '431000'); INSERT INTO booktest_areainfo VALUES ('431025', 'Linwu County', '431000'); INSERT INTO booktest_areainfo VALUES ('431026', 'Rucheng County', '431000'); INSERT INTO booktest_areainfo VALUES ('431027', 'Guidong County', '431000'); INSERT INTO booktest_areainfo VALUES ('431028', 'Anren County', '431000'); INSERT INTO booktest_areainfo VALUES ('431081', 'Zixing City', '431000'); INSERT INTO booktest_areainfo VALUES ('431100', 'Yongzhou City', '430000'); INSERT INTO booktest_areainfo VALUES ('431102', 'Lingling District', '431100'); INSERT INTO booktest_areainfo VALUES ('431103', 'Lengshuitan District', '431100'); INSERT INTO booktest_areainfo VALUES ('431121', 'Qiyang County', '431100'); INSERT INTO booktest_areainfo VALUES ('431122', 'Dongan County', '431100'); INSERT INTO booktest_areainfo VALUES ('431123', 'Shuangpai County', '431100'); INSERT INTO booktest_areainfo VALUES ('431124', 'Daoxian County', '431100'); INSERT INTO booktest_areainfo VALUES ('431125', 'Jiangyong County', '431100'); INSERT INTO booktest_areainfo VALUES ('431126', 'Ningyuan County', '431100'); INSERT INTO booktest_areainfo VALUES ('431127', 'Lanshan County', '431100'); INSERT INTO booktest_areainfo VALUES ('431128', 'Xintian County', '431100'); INSERT INTO booktest_areainfo VALUES ('431129', 'Jianghua Yao Autonomous County', '431100'); INSERT INTO booktest_areainfo VALUES ('431200', 'huaihua', '430000'); INSERT INTO booktest_areainfo VALUES ('431202', 'Hecheng District', '431200'); INSERT INTO booktest_areainfo VALUES ('431221', 'China County', '431200'); INSERT INTO booktest_areainfo VALUES ('431222', 'Yuanling County', '431200'); INSERT INTO booktest_areainfo VALUES ('431223', 'Chenxi County', '431200'); INSERT INTO booktest_areainfo VALUES ('431224', 'Xupu County', '431200'); INSERT INTO booktest_areainfo VALUES ('431225', 'Huitong County', '431200'); INSERT INTO booktest_areainfo VALUES ('431226', 'Mayang Miao Autonomous County ', '431200'); INSERT INTO booktest_areainfo VALUES ('431227', 'Xinhuang Dong Autonomous County', '431200'); INSERT INTO booktest_areainfo VALUES ('431228', 'Zhijiang Dong Autonomous County ', '431200'); INSERT INTO booktest_areainfo VALUES ('431229', 'Jingzhou Miao and Dong Autonomous County', '431200'); INSERT INTO booktest_areainfo VALUES ('431230', 'Tongdao Dong Autonomous County', '431200'); INSERT INTO booktest_areainfo VALUES ('431281', 'Hongjiang City', '431200'); INSERT INTO booktest_areainfo VALUES ('431300', 'Loudi City', '430000'); INSERT INTO booktest_areainfo VALUES ('431302', 'Lou Xing District', '431300'); INSERT INTO booktest_areainfo VALUES ('431321', 'Shuangfeng County', '431300'); INSERT INTO booktest_areainfo VALUES ('431322', 'Xinhua County', '431300'); INSERT INTO booktest_areainfo VALUES ('431381', 'Lengshuijiang City', '431300'); INSERT INTO booktest_areainfo VALUES ('431382', 'Lianyuan City', '431300'); INSERT INTO booktest_areainfo VALUES ('433100', 'Xiangxi Tujia and Miao Autonomous Prefecture', '430000'); INSERT INTO booktest_areainfo VALUES ('433101', 'Jishou City', '433100'); INSERT INTO booktest_areainfo VALUES ('433122', 'Luxi County', '433100'); INSERT INTO booktest_areainfo VALUES ('433123', 'Fenghuang County', '433100'); INSERT INTO booktest_areainfo VALUES ('433124', 'Huayuan County', '433100'); INSERT INTO booktest_areainfo VALUES ('433125', 'Baojing County', '433100'); INSERT INTO booktest_areainfo VALUES ('433126', 'Guzhang County', '433100'); INSERT INTO booktest_areainfo VALUES ('433127', 'Yongshun County', '433100'); INSERT INTO booktest_areainfo VALUES ('433130', 'Longshan County', '433100');