乡、社区的区域编码数据库表结构Sql
数据库版本的省市县级sql代码
INSERT INTO `表名称` V ALUES (1, '0', '北京市'); INSERT INTO `表名称` V ALUES (35, '1', '东城区'); INSERT INTO `表名称` V ALUES (36, '1', '西城区'); INSERT INTO `表名称` V ALUES (37, '1', '崇文区'); INSERT INTO `表名称` V ALUES (38, '1', '宣武区'); INSERT INTO `表名称` V ALUES (39, '1', '朝阳区'); INSERT INTO `表名称` V ALUES (40, '1', '丰台区'); INSERT INTO `表名称` V ALUES (41, '1', '石景山区'); INSERT INTO `表名称` V ALUES (42, '1', '海淀区'); INSERT INTO `表名称` V ALUES (43, '1', '门头沟区'); INSERT INTO `表名称` V ALUES (44, '1', '房山区'); INSERT INTO `表名称` V ALUES (45, '1', '通州区'); INSERT INTO `表名称` V ALUES (46, '1', '顺义区'); INSERT INTO `表名称` V ALUES (47, '1', '昌平区'); INSERT INTO `表名称` V ALUES (48, '1', '大兴区'); INSERT INTO `表名称` V ALUES (49, '1', '怀柔区'); INSERT INTO `表名称` V ALUES (50, '1', '平谷区'); INSERT INTO `表名称` V ALUES (51, '1', '密云县'); INSERT INTO `表名称` V ALUES (52, '1', '延庆县'); INSERT INTO `表名称` V ALUES (2, '0', '天津市'); INSERT INTO `表名称` V ALUES (535, '2', '和平区'); INSERT INTO `表名称` V ALUES (536, '2', '河东区'); INSERT INTO `表名称` V ALUES (537, '2', '河西区'); INSERT INTO `表名称` V ALUES (538, '2', '南开区'); INSERT INTO `表名称` V ALUES (539, '2', '河北区'); INSERT INTO `表名称` V ALUES (540, '2', '红桥区'); INSERT INTO `表名称` V ALUES (541, '2', '塘沽区'); INSERT INTO `表名称` V ALUES (542, '2', '汉沽区'); INSERT INTO `表名称` V ALUES (543, '2', '大港区'); INSERT INTO `表名称` V ALUES (544, '2', '东丽区'); INSERT INTO `表名称` V ALUES (545, '2', '西青区'); INSERT INTO `表名称` V ALUES (546, '2', '津南区'); INSERT INTO `表名称` V ALUES (547, '2', '北辰区'); INSERT INTO `表名称` V ALUES (548, '2', '武清区'); INSERT INTO `表名称` V ALUES (549, '2', '宝坻区'); INSERT INTO `表名称` V ALUES (550, '2', '宁河县'); INSERT INTO `表名称` V ALUES (551, '2', '静海县'); INSERT INTO `表名称` V ALUES (552, '2', '蓟县'); INSERT INTO `表名称` V ALUES (3, '0', '河北省'); INSERT INTO `表名称` V ALUES (1035, '3', '石家庄市'); INSERT INTO `表名称` V ALUES (20011, '1035', '长安区'); INSERT INTO `表名称` V ALUES (200110, '1035', '行唐县'); INSERT INTO `表名称` V ALUES (200111, '1035', '灵寿县'); INSERT INTO `表名称` V ALUES (200112, '1035', '高邑县');INSERT INTO `表名称` V ALUES (200114, '1035', '赞皇县'); INSERT INTO `表名称` V ALUES (200115, '1035', '无极县'); INSERT INTO `表名称` V ALUES (200116, '1035', '平山县'); INSERT INTO `表名称` V ALUES (200117, '1035', '元氏县'); INSERT INTO `表名称` V ALUES (200118, '1035', '赵县'); INSERT INTO `表名称` V ALUES (200119, '1035', '辛集市'); INSERT INTO `表名称` V ALUES (20012, '1035', '桥东区'); INSERT INTO `表名称` V ALUES (200120, '1035', '藁城市'); INSERT INTO `表名称` V ALUES (200121, '1035', '晋州市'); INSERT INTO `表名称` V ALUES (200122, '1035', '新乐市'); INSERT INTO `表名称` V ALUES (200123, '1035', '鹿泉市'); INSERT INTO `表名称` V ALUES (20013, '1035', '桥西区'); INSERT INTO `表名称` V ALUES (20014, '1035', '新华区'); INSERT INTO `表名称` V ALUES (20015, '1035', '井陉矿区'); INSERT INTO `表名称` V ALUES (20016, '1035', '裕华区'); INSERT INTO `表名称` V ALUES (20017, '1035', '井陉县'); INSERT INTO `表名称` V ALUES (20018, '1035', '正定县'); INSERT INTO `表名称` V ALUES (20019, '1035', '栾城县'); INSERT INTO `表名称` V ALUES (1036, '3', '唐山市');INSERT INTO `表名称` V ALUES (20021, '1036', '路南区'); INSERT INTO `表名称` V ALUES (200210, '1036', '迁西县'); INSERT INTO `表名称` V ALUES (200211, '1036', '玉田县'); INSERT INTO `表名称` V ALUES (200212, '1036', '唐海县'); INSERT INTO `表名称` V ALUES (200213, '1036', '遵化市'); INSERT INTO `表名称` V ALUES (200214, '1036', '迁安市'); INSERT INTO `表名称` V ALUES (20022, '1036', '路北区'); INSERT INTO `表名称` V ALUES (20023, '1036', '古冶区'); INSERT INTO `表名称` V ALUES (20024, '1036', '开平区'); INSERT INTO `表名称` V ALUES (20025, '1036', '丰南区'); INSERT INTO `表名称` V ALUES (20026, '1036', '丰润区'); INSERT INTO `表名称` V ALUES (20027, '1036', '滦县'); INSERT INTO `表名称` V ALUES (20028, '1036', '滦南县'); INSERT INTO `表名称` V ALUES (20029, '1036', '乐亭县'); INSERT INTO `表名称` V ALUES (1037, '3', '秦皇岛市');INSERT INTO `表名称` V ALUES (20031, '1037', '海港区'); INSERT INTO `表名称` V ALUES (20032, '1037', '山海关区'); INSERT INTO `表名称` V ALUES (20033, '1037', '北戴河区'); INSERT INTO `表名称` V ALUES (20034, '1037', '青龙满族自治县'); INSERT INTO `表名称` V ALUES (20035, '1037', '昌黎县'); INSERT INTO `表名称` V ALUES (20036, '1037', '抚宁县'); INSERT INTO `表名称` V ALUES (20037, '1037', '卢龙县'); INSERT INTO `表名称` V ALUES (1038, '3', '邯郸市');INSERT INTO `表名称` V ALUES (20041, '1038', '市辖区');INSERT INTO `表名称` V ALUES (200411, '1038', '磁县'); INSERT INTO `表名称` V ALUES (200412, '1038', '肥乡县'); INSERT INTO `表名称` V ALUES (200413, '1038', '永年县'); INSERT INTO `表名称` V ALUES (200414, '1038', '邱县'); INSERT INTO `表名称` V ALUES (200415, '1038', '鸡泽县'); INSERT INTO `表名称` V ALUES (200416, '1038', '广平县'); INSERT INTO `表名称` V ALUES (200417, '1038', '馆陶县'); INSERT INTO `表名称` V ALUES (200418, '1038', '魏县'); INSERT INTO `表名称` V ALUES (200419, '1038', '曲周县'); INSERT INTO `表名称` V ALUES (20042, '1038', '邯山区'); INSERT INTO `表名称` V ALUES (200420, '1038', '武安市'); INSERT INTO `表名称` V ALUES (20043, '1038', '丛台区'); INSERT INTO `表名称` V ALUES (20044, '1038', '复兴区'); INSERT INTO `表名称` V ALUES (20045, '1038', '峰峰矿区'); INSERT INTO `表名称` V ALUES (20046, '1038', '邯郸县'); INSERT INTO `表名称` V ALUES (20047, '1038', '临漳县'); INSERT INTO `表名称` V ALUES (20048, '1038', '成安县'); INSERT INTO `表名称` V ALUES (20049, '1038', '大名县'); INSERT INTO `表名称` V ALUES (1039, '3', '邢台市'); INSERT INTO `表名称` V ALUES (20051, '1039', '桥东区'); INSERT INTO `表名称` V ALUES (200510, '1039', '宁晋县'); INSERT INTO `表名称` V ALUES (200511, '1039', '巨鹿县'); INSERT INTO `表名称` V ALUES (200512, '1039', '新河县'); INSERT INTO `表名称` V ALUES (200513, '1039', '广宗县'); INSERT INTO `表名称` V ALUES (200514, '1039', '平乡县'); INSERT INTO `表名称` V ALUES (200515, '1039', '威县'); INSERT INTO `表名称` V ALUES (200516, '1039', '清河县'); INSERT INTO `表名称` V ALUES (200517, '1039', '临西县'); INSERT INTO `表名称` V ALUES (200518, '1039', '南宫市'); INSERT INTO `表名称` V ALUES (200519, '1039', '沙河市'); INSERT INTO `表名称` V ALUES (20052, '1039', '桥西区'); INSERT INTO `表名称` V ALUES (20053, '1039', '邢台县'); INSERT INTO `表名称` V ALUES (20054, '1039', '临城县'); INSERT INTO `表名称` V ALUES (20055, '1039', '内丘县'); INSERT INTO `表名称` V ALUES (20056, '1039', '柏乡县'); INSERT INTO `表名称` V ALUES (20057, '1039', '隆尧县'); INSERT INTO `表名称` V ALUES (20058, '1039', '任县'); INSERT INTO `表名称` V ALUES (20059, '1039', '南和县'); INSERT INTO `表名称` V ALUES (1040, '3', '保定市'); INSERT INTO `表名称` V ALUES (20061, '1040', '新市区'); INSERT INTO `表名称` V ALUES (200610, '1040', '唐县'); INSERT INTO `表名称` V ALUES (200611, '1040', '高阳县'); INSERT INTO `表名称` V ALUES (200612, '1040', '容城县');INSERT INTO `表名称` V ALUES (200614, '1040', '望都县');INSERT INTO `表名称` V ALUES (200615, '1040', '安新县');INSERT INTO `表名称` V ALUES (200616, '1040', '易县');INSERT INTO `表名称` V ALUES (200617, '1040', '曲阳县');INSERT INTO `表名称` V ALUES (200618, '1040', '蠡县');INSERT INTO `表名称` V ALUES (200619, '1040', '顺平县');INSERT INTO `表名称` V ALUES (20062, '1040', '北市区');INSERT INTO `表名称` V ALUES (200620, '1040', '博野县');INSERT INTO `表名称` V ALUES (200621, '1040', '雄县');INSERT INTO `表名称` V ALUES (200622, '1040', '涿州市');INSERT INTO `表名称` V ALUES (200623, '1040', '定州市');INSERT INTO `表名称` V ALUES (200624, '1040', '安国市');INSERT INTO `表名称` V ALUES (200625, '1040', '高碑店市');INSERT INTO `表名称` V ALUES (20063, '1040', '南市区');INSERT INTO `表名称` V ALUES (20064, '1040', '满城县');INSERT INTO `表名称` V ALUES (20065, '1040', '清苑县');INSERT INTO `表名称` V ALUES (20066, '1040', '涞水县');INSERT INTO `表名称` V ALUES (20067, '1040', '阜平县');INSERT INTO `表名称` V ALUES (20068, '1040', '徐水县');INSERT INTO `表名称` V ALUES (20069, '1040', '定兴县');INSERT INTO `表名称` V ALUES (1041, '3', '张家口市');INSERT INTO `表名称` V ALUES (20071, '1041', '桥东区');INSERT INTO `表名称` V ALUES (200710, '1041', '蔚县');INSERT INTO `表名称` V ALUES (200711, '1041', '阳原县');INSERT INTO `表名称` V ALUES (200712, '1041', '怀安县');INSERT INTO `表名称` V ALUES (200713, '1041', '万全县');INSERT INTO `表名称` V ALUES (200714, '1041', '怀来县');INSERT INTO `表名称` V ALUES (200715, '1041', '涿鹿县');INSERT INTO `表名称` V ALUES (200716, '1041', '赤城县');INSERT INTO `表名称` V ALUES (200717, '1041', '崇礼县');INSERT INTO `表名称` V ALUES (20072, '1041', '桥西区');INSERT INTO `表名称` V ALUES (20073, '1041', '宣化区');INSERT INTO `表名称` V ALUES (20074, '1041', '下花园区');INSERT INTO `表名称` V ALUES (20075, '1041', '宣化县');INSERT INTO `表名称` V ALUES (20076, '1041', '张北县');INSERT INTO `表名称` V ALUES (20077, '1041', '康保县');INSERT INTO `表名称` V ALUES (20078, '1041', '沽源县');INSERT INTO `表名称` V ALUES (20079, '1041', '尚义县');INSERT INTO `表名称` V ALUES (1042, '3', '承德市');INSERT INTO `表名称` V ALUES (20081, '1042', '双桥区');INSERT INTO `表名称` V ALUES (200810, '1042', '宽城满族自治'); INSERT INTO `表名称` V ALUES (200811, '1042', ' 围场满族蒙古族自治县'); INSERT INTO `表名称` V ALUES (20082, '1042', '双滦区');INSERT INTO `表名称` V ALUES (20083, '1042', '鹰手营子矿区'); INSERT INTO `表名称` V ALUES (20084, '1042', '承德县'); INSERT INTO `表名称` V ALUES (20085, '1042', '兴隆县'); INSERT INTO `表名称` V ALUES (20086, '1042', '平泉县'); INSERT INTO `表名称` V ALUES (20087, '1042', '滦平县'); INSERT INTO `表名称` V ALUES (20088, '1042', '隆化县'); INSERT INTO `表名称` V ALUES (20089, '1042', '丰宁满族自治县'); INSERT INTO `表名称` V ALUES (1043, '3', '廊坊市');INSERT INTO `表名称` V ALUES (20091, '1043', '安次区'); INSERT INTO `表名称` V ALUES (200910, '1043', '三河市'); INSERT INTO `表名称` V ALUES (20092, '1043', '广阳区'); INSERT INTO `表名称` V ALUES (20093, '1043', '固安县'); INSERT INTO `表名称` V ALUES (20094, '1043', '永清县'); INSERT INTO `表名称` V ALUES (20095, '1043', '香河县'); INSERT INTO `表名称` V ALUES (20096, '1043', '大城县'); INSERT INTO `表名称` V ALUES (20097, '1043', '文安县'); INSERT INTO `表名称` V ALUES (20098, '1043', '大厂回族自治县'); INSERT INTO `表名称` V ALUES (20099, '1043', '霸州市'); INSERT INTO `表名称` V ALUES (1044, '3', '衡水市');INSERT INTO `表名称` V ALUES (20101, '1044', '桃城区'); INSERT INTO `表名称` V ALUES (201010, '1044', '冀州市'); INSERT INTO `表名称` V ALUES (201011, '1044', '深州市'); INSERT INTO `表名称` V ALUES (20102, '1044', '枣强县'); INSERT INTO `表名称` V ALUES (20103, '1044', '武邑县'); INSERT INTO `表名称` V ALUES (20104, '1044', '武强县'); INSERT INTO `表名称` V ALUES (20105, '1044', '饶阳县'); INSERT INTO `表名称` V ALUES (20106, '1044', '安平县'); INSERT INTO `表名称` V ALUES (20107, '1044', '故城县'); INSERT INTO `表名称` V ALUES (20108, '1044', '景县'); INSERT INTO `表名称` V ALUES (20109, '1044', '阜城县'); INSERT INTO `表名称` V ALUES (1045, '3', '沧州市');INSERT INTO `表名称` V ALUES (20111, '1045', '新华区');INSERT INTO `表名称` V ALUES (201110, '1045', '吴桥县'); INSERT INTO `表名称` V ALUES (201111, '1045', '献县'); INSERT INTO `表名称` V ALUES (201112, '1045', '孟村回族自治县'); INSERT INTO `表名称` V ALUES (201113, '1045', '泊头市'); INSERT INTO `表名称` V ALUES (201114, '1045', '任丘市'); INSERT INTO `表名称` V ALUES (201115, '1045', '黄骅市'); INSERT INTO `表名称` V ALUES (201116, '1045', '河间市'); INSERT INTO `表名称` V ALUES (20112, '1045', '运河区'); INSERT INTO `表名称` V ALUES (20113, '1045', '沧县'); INSERT INTO `表名称` V ALUES (20114, '1045', '青县'); INSERT INTO `表名称` V ALUES (20115, '1045', '东光县'); INSERT INTO `表名称` V ALUES (20116, '1045', '海兴县');INSERT INTO `表名称` V ALUES (20118, '1045', '肃宁县'); INSERT INTO `表名称` V ALUES (20119, '1045', '南皮县'); INSERT INTO `表名称` V ALUES (4, '0', '山西省'); INSERT INTO `表名称` V ALUES (1535, '4', '太原市'); INSERT INTO `表名称` V ALUES (25011, '1535', '小店区'); INSERT INTO `表名称` V ALUES (250110, '1535', '古交市'); INSERT INTO `表名称` V ALUES (25012, '1535', '迎泽区'); INSERT INTO `表名称` V ALUES (25013, '1535', '杏花岭区'); INSERT INTO `表名称` V ALUES (25014, '1535', '尖草坪区'); INSERT INTO `表名称` V ALUES (25015, '1535', '万柏林区'); INSERT INTO `表名称` V ALUES (25016, '1535', '晋源区'); INSERT INTO `表名称` V ALUES (25017, '1535', '清徐县'); INSERT INTO `表名称` V ALUES (25018, '1535', '阳曲县'); INSERT INTO `表名称` V ALUES (25019, '1535', '娄烦县'); INSERT INTO `表名称` V ALUES (1536, '4', '大同市'); INSERT INTO `表名称` V ALUES (25021, '1536', '南郊区'); INSERT INTO `表名称` V ALUES (250210, '1536', '城区'); INSERT INTO `表名称` V ALUES (250211, '1536', '矿区'); INSERT INTO `表名称` V ALUES (250212, '1536', '南郊区'); INSERT INTO `表名称` V ALUES (25022, '1536', '新荣区'); INSERT INTO `表名称` V ALUES (25023, '1536', '阳高县'); INSERT INTO `表名称` V ALUES (25024, '1536', '天镇县'); INSERT INTO `表名称` V ALUES (25025, '1536', '广灵县'); INSERT INTO `表名称` V ALUES (25026, '1536', '灵丘县'); INSERT INTO `表名称` V ALUES (25027, '1536', '浑源县'); INSERT INTO `表名称` V ALUES (25028, '1536', '左云县'); INSERT INTO `表名称` V ALUES (25029, '1536', '大同县'); INSERT INTO `表名称` V ALUES (1537, '4', '阳泉市'); INSERT INTO `表名称` V ALUES (25031, '1537', '城区'); INSERT INTO `表名称` V ALUES (25032, '1537', '矿区'); INSERT INTO `表名称` V ALUES (25033, '1537', '郊区'); INSERT INTO `表名称` V ALUES (25034, '1537', '平定县'); INSERT INTO `表名称` V ALUES (25035, '1537', '盂县'); INSERT INTO `表名称` V ALUES (1538, '4', '长治市'); INSERT INTO `表名称` V ALUES (25041, '1538', '城区'); INSERT INTO `表名称` V ALUES (250410, '1538', '武乡县'); INSERT INTO `表名称` V ALUES (250411, '1538', '沁县'); INSERT INTO `表名称` V ALUES (250412, '1538', '沁源县'); INSERT INTO `表名称` V ALUES (250413, '1538', '潞城市'); INSERT INTO `表名称` V ALUES (25042, '1538', '郊区'); INSERT INTO `表名称` V ALUES (25043, '1538', '长治县'); INSERT INTO `表名称` V ALUES (25044, '1538', '襄垣县'); INSERT INTO `表名称` V ALUES (25045, '1538', '屯留县');INSERT INTO `表名称` V ALUES (25047, '1538', '黎城县'); INSERT INTO `表名称` V ALUES (25048, '1538', '壶关县'); INSERT INTO `表名称` V ALUES (25049, '1538', '长子县'); INSERT INTO `表名称` V ALUES (1539, '4', '晋城市'); INSERT INTO `表名称` V ALUES (25051, '1539', '城区'); INSERT INTO `表名称` V ALUES (25052, '1539', '沁水县'); INSERT INTO `表名称` V ALUES (25053, '1539', '阳城县'); INSERT INTO `表名称` V ALUES (25054, '1539', '陵川县'); INSERT INTO `表名称` V ALUES (25055, '1539', '泽州县'); INSERT INTO `表名称` V ALUES (25056, '1539', '高平市'); INSERT INTO `表名称` V ALUES (1540, '4', '朔州市'); INSERT INTO `表名称` V ALUES (25061, '1540', '朔城区'); INSERT INTO `表名称` V ALUES (25062, '1540', '平鲁区'); INSERT INTO `表名称` V ALUES (25063, '1540', '山阴县'); INSERT INTO `表名称` V ALUES (25064, '1540', '应县'); INSERT INTO `表名称` V ALUES (25065, '1540', '右玉县'); INSERT INTO `表名称` V ALUES (25066, '1540', '怀仁县'); INSERT INTO `表名称` V ALUES (1541, '4', '晋中市'); INSERT INTO `表名称` V ALUES (25071, '1541', '榆次区'); INSERT INTO `表名称` V ALUES (250710, '1541', '灵石县'); INSERT INTO `表名称` V ALUES (250711, '1541', '介休市'); INSERT INTO `表名称` V ALUES (25072, '1541', '榆社县'); INSERT INTO `表名称` V ALUES (25073, '1541', '左权县'); INSERT INTO `表名称` V ALUES (25074, '1541', '和顺县'); INSERT INTO `表名称` V ALUES (25075, '1541', '昔阳县'); INSERT INTO `表名称` V ALUES (25076, '1541', '寿阳县'); INSERT INTO `表名称` V ALUES (25077, '1541', '太谷县'); INSERT INTO `表名称` V ALUES (25078, '1541', '祁县'); INSERT INTO `表名称` V ALUES (25079, '1541', '平遥县'); INSERT INTO `表名称` V ALUES (1542, '4', '运城市'); INSERT INTO `表名称` V ALUES (25081, '1542', '盐湖区'); INSERT INTO `表名称` V ALUES (250810, '1542', '平陆县'); INSERT INTO `表名称` V ALUES (250811, '1542', '芮城县'); INSERT INTO `表名称` V ALUES (250812, '1542', '永济市'); INSERT INTO `表名称` V ALUES (250813, '1542', '河津市'); INSERT INTO `表名称` V ALUES (25082, '1542', '临猗县'); INSERT INTO `表名称` V ALUES (25083, '1542', '万荣县'); INSERT INTO `表名称` V ALUES (25084, '1542', '闻喜县'); INSERT INTO `表名称` V ALUES (25085, '1542', '稷山县'); INSERT INTO `表名称` V ALUES (25086, '1542', '新绛县'); INSERT INTO `表名称` V ALUES (25087, '1542', '绛县'); INSERT INTO `表名称` V ALUES (25088, '1542', '垣曲县'); INSERT INTO `表名称` V ALUES (25089, '1542', '夏县');INSERT INTO `表名称` V ALUES (1543, '4', '忻州市'); INSERT INTO `表名称` V ALUES (25091, '1543', '忻府区'); INSERT INTO `表名称` V ALUES (250910, '1543', '岢岚县'); INSERT INTO `表名称` V ALUES (250911, '1543', '河曲县'); INSERT INTO `表名称` V ALUES (250912, '1543', '保德县'); INSERT INTO `表名称` V ALUES (250913, '1543', '偏关县'); INSERT INTO `表名称` V ALUES (250914, '1543', '原平市'); INSERT INTO `表名称` V ALUES (25092, '1543', '定襄县'); INSERT INTO `表名称` V ALUES (25093, '1543', '五台县'); INSERT INTO `表名称` V ALUES (25094, '1543', '代县'); INSERT INTO `表名称` V ALUES (25095, '1543', '繁峙县'); INSERT INTO `表名称` V ALUES (25096, '1543', '宁武县'); INSERT INTO `表名称` V ALUES (25097, '1543', '静乐县'); INSERT INTO `表名称` V ALUES (25098, '1543', '神池县'); INSERT INTO `表名称` V ALUES (25099, '1543', '五寨县'); INSERT INTO `表名称` V ALUES (1544, '4', '临汾市'); INSERT INTO `表名称` V ALUES (25101, '1544', '尧都区'); INSERT INTO `表名称` V ALUES (251010, '1544', '乡宁县'); INSERT INTO `表名称` V ALUES (251011, '1544', '大宁县'); INSERT INTO `表名称` VALUES (251012, '1544', '隰县'); INSERT INTO `表名称` V ALUES (251013, '1544', '永和县'); INSERT INTO `表名称` V ALUES (251014, '1544', '蒲县'); INSERT INTO `表名称` V ALUES (251015, '1544', '汾西县'); INSERT INTO `表名称` V ALUES (251016, '1544', '侯马市'); INSERT INTO `表名称` V ALUES (251017, '1544', '霍州市'); INSERT INTO `表名称` V ALUES (25102, '1544', '曲沃县'); INSERT INTO `表名称` V ALUES (25103, '1544', '翼城县'); INSERT INTO `表名称` V ALUES (25104, '1544', '襄汾县'); INSERT INTO `表名称` V ALUES (25105, '1544', '洪洞县'); INSERT INTO `表名称` V ALUES (25106, '1544', '古县'); INSERT INTO `表名称` V ALUES (25107, '1544', '安泽县'); INSERT INTO `表名称` V ALUES (25108, '1544', '浮山县'); INSERT INTO `表名称` V ALUES (25109, '1544', '吉县'); INSERT INTO `表名称` V ALUES (1545, '4', '吕梁市'); INSERT INTO `表名称` V ALUES (25111, '1545', '离石区'); INSERT INTO `表名称` V ALUES (251110, '1545', '中阳县'); INSERT INTO `表名称` V ALUES (251111, '1545', '交口县'); INSERT INTO `表名称` V ALUES (251112, '1545', '孝义市'); INSERT INTO `表名称` V ALUES (251113, '1545', '汾阳市'); INSERT INTO `表名称` V ALUES (25112, '1545', '文水县'); INSERT INTO `表名称` V ALUES (25113, '1545', '交城县'); INSERT INTO `表名称` V ALUES (25114, '1545', '兴县'); INSERT INTO `表名称` V ALUES (25115, '1545', '临县'); INSERT INTO `表名称` V ALUES (25116, '1545', '柳林县');INSERT INTO `表名称` V ALUES (25117, '1545', '石楼县');INSERT INTO `表名称` VALUES (25118, '1545', '岚县');INSERT INTO `表名称` V ALUES (25119, '1545', '方山县');INSERT INTO `表名称` V ALUES (5, '0', '内蒙古自治区');INSERT INTO `表名称` V ALUES (2035, '5', '呼和浩特市');INSERT INTO `表名称` V ALUES (30011, '2035', '新城区');INSERT INTO `表名称` V ALUES (30012, '2035', '回民区');INSERT INTO `表名称` V ALUES (30013, '2035', '玉泉区');INSERT INTO `表名称` V ALUES (30014, '2035', '赛罕区');INSERT INTO `表名称` V ALUES (30015, '2035', '土默特左旗'); INSERT INTO `表名称` V ALUES (30016, '2035', '托克托县');INSERT INTO `表名称` V ALUES (30017, '2035', '和林格尔县'); INSERT INTO `表名称` V ALUES (30018, '2035', '清水河县');INSERT INTO `表名称` V ALUES (30019, '2035', '武川县');INSERT INTO `表名称` V ALUES (2036, '5', '包头市');INSERT INTO `表名称` V ALUES (30021, '2036', '东河区');INSERT INTO `表名称` V ALUES (30022, '2036', '昆都仑区');INSERT INTO `表名称` V ALUES (30023, '2036', '青山区');INSERT INTO `表名称` V ALUES (30024, '2036', '石拐区');INSERT INTO `表名称` V ALUES (30025, '2036', '白云矿区');INSERT INTO `表名称` V ALUES (30026, '2036', '九原区');INSERT INTO `表名称` V ALUES (30027, '2036', '土默特右旗'); INSERT INTO `表名称` V ALUES (30028, '2036', '固阳县');INSERT INTO `表名称` V ALUES (30029, '2036', '达尔罕茂明安联合旗'); INSERT INTO `表名称` V ALUES (2037, '5', '乌海市');INSERT INTO `表名称` V ALUES (30031, '2037', '海勃湾区');INSERT INTO `表名称` V ALUES (30032, '2037', '海南区');INSERT INTO `表名称` V ALUES (30033, '2037', '乌达区');INSERT INTO `表名称` V ALUES (2038, '5', '赤峰市');INSERT INTO `表名称` V ALUES (30041, '2038', '红山区');INSERT INTO `表名称` V ALUES (300410, '2038', '喀喇沁旗');INSERT INTO `表名称` V ALUES (300411, '2038', '宁城县');INSERT INTO `表名称` V ALUES (300412, '2038', '敖汉旗');INSERT INTO `表名称` V ALUES (30042, '2038', '元宝山区');INSERT INTO `表名称` V ALUES (30043, '2038', '松山区');INSERT INTO `表名称` V ALUES (30044, '2038', '阿鲁科尔沁旗'); INSERT INTO `表名称` V ALUES (30045, '2038', '巴林左旗');INSERT INTO `表名称` V ALUES (30046, '2038', '巴林右旗');INSERT INTO `表名称` V ALUES (30047, '2038', '林西县');INSERT INTO `表名称` V ALUES (30048, '2038', '克什克腾旗'); INSERT INTO `表名称` V ALUES (30049, '2038', '翁牛特旗');INSERT INTO `表名称` V ALUES (2039, '5', '通辽市');INSERT INTO `表名称` V ALUES (30051, '2039', '科尔沁区');INSERT INTO `表名称` V ALUES (30052, '2039', '科尔沁左翼中旗');INSERT INTO `表名称` V ALUES (30053, '2039', '科尔沁左翼后旗'); INSERT INTO `表名称` V ALUES (30054, '2039', '开鲁县');INSERT INTO `表名称` V ALUES (30055, '2039', '库伦旗');INSERT INTO `表名称` V ALUES (30056, '2039', '奈曼旗');INSERT INTO `表名称` V ALUES (30057, '2039', '扎鲁特旗');INSERT INTO `表名称` V ALUES (30058, '2039', '霍林郭勒市');INSERT INTO `表名称` V ALUES (2040, '5', '鄂尔多斯市');INSERT INTO `表名称` V ALUES (30061, '2040', '东胜区');INSERT INTO `表名称` V ALUES (30062, '2040', '达拉特旗');INSERT INTO `表名称` V ALUES (30063, '2040', '准格尔旗');INSERT INTO `表名称` V ALUES (30064, '2040', '鄂托克前旗');INSERT INTO `表名称` V ALUES (30065, '2040', '鄂托克旗');INSERT INTO `表名称` V ALUES (30066, '2040', '杭锦旗');INSERT INTO `表名称` V ALUES (30067, '2040', '乌审旗');INSERT INTO `表名称` VALUES (30068, '2040', '伊金霍洛旗');INSERT INTO `表名称` V ALUES (2041, '5', '呼伦贝尔市');INSERT INTO `表名称` V ALUES (30071, '2041', '海拉尔区');INSERT INTO `表名称` V ALUES (300710, '2041', '牙克石市');INSERT INTO `表名称` V ALUES (300711, '2041', '扎兰屯市');INSERT INTO `表名称` V ALUES (300712, '2041', '额尔古纳市');INSERT INTO `表名称` V ALUES (300713, '2041', '根河市');INSERT INTO `表名称` V ALUES (30072, '2041', '阿荣旗');INSERT INTO `表名称` V ALUES (30073, '2041', '莫力达瓦达斡尔族自治旗'); INSERT INTO `表名称` V ALUES (30074, '2041', '鄂伦春自治旗');INSERT INTO `表名称` V ALUES (30075, '2041', '鄂温克族自治旗'); INSERT INTO `表名称` V ALUES (30076, '2041', '陈巴尔虎旗');INSERT INTO `表名称` V ALUES (30077, '2041', '新巴尔虎左旗');INSERT INTO `表名称` V ALUES (30078, '2041', '新巴尔虎右旗');INSERT INTO `表名称` V ALUES (30079, '2041', '满洲里市');INSERT INTO `表名称` VALUES (2042, '5', '巴彦淖尔市');INSERT INTO `表名称` V ALUES (30081, '2042', '临河区');INSERT INTO `表名称` V ALUES (30082, '2042', '五原县');INSERT INTO `表名称` V ALUES (30083, '2042', '磴口县');INSERT INTO `表名称` V ALUES (30084, '2042', '乌拉特前旗');INSERT INTO `表名称` V ALUES (30085, '2042', '乌拉特中旗');INSERT INTO `表名称` V ALUES (30086, '2042', '乌拉特后旗');INSERT INTO `表名称` V ALUES (30087, '2042', '杭锦后旗');INSERT INTO `表名称` V ALUES (2043, '5', '乌兰察布市');INSERT INTO `表名称` V ALUES (30091, '2043', '集宁区');INSERT INTO `表名称` V ALUES (300910, '2043', '四子王旗');INSERT INTO `表名称` V ALUES (300911, '2043', '丰镇市');INSERT INTO `表名称` V ALUES (30092, '2043', '卓资县');INSERT INTO `表名称` V ALUES (30093, '2043', '化德县');INSERT INTO `表名称` V ALUES (30094, '2043', '商都县');。
SQL数据库设计,编码开发规范(转)
SQL数据库设计,编码开发规范(转)SQL Server Database Design, Code and DevelopmentStandards1.更改Change Name Date命名原则:表意性原则(增加) DavidDong Jan/05数据库命名DavidDong Jan/05表命名DavidDong Jan/05Server/Instance命名DavidDong Jan/05JOB,复制命名DavidDong Jan/052.简介数据库设计是指对于⼀个给定的应⽤环境,构造最优的数据库模式,建⽴数据库及其应⽤系统,有效存储数据,满⾜⽤户信息要求和处理要求数据库设计和开发标准是使Newegg Support Center的数据库系统的设计和开发正式化的标准。
通过此标准,来规范数据库设计。
通过⼀致的系统解决⽅案,能给我们的系统带来以下优点:¨开发出⾼可管理性的⾼质量系统¨能够快速的进⾏开发¨减少维护代码的时间Ø ⾮常容易的把代码从⼀个项⽬拷贝⾄另⼀个项⽬Ø 节省把游标,错误处理信息从⼀个项⽬中拷贝到另⼀个项⽬中的时间Ø 使程序逻辑简单化Ø 不⽤花费时间在常规的事情上,⽐如对象名称转换等,并可允许多次设计,编程和对复杂事件的测试⼯作¨在代码出错时⼤⼤节省时间¨只要在第⼀次是有个良好的设计3.开发环境3.1数据库模型CA公司的ERwin/SQL是数据建模的⼀个⾸选⼯具.在开发经常改变的项⽬时,使⽤ERwin来⽣成表(创建/删除),索引,规则,数据类型等数据库对象的脚本,在对项⽬⽂件进⾏修改之前,请确认已经对这些脚本进⾏过备份.任何数据库的改变,不管是在开发中还是在产品服务器中,都要⽤ERwinDiagram中进⾏相应的修改.如果产品服务器上做出了更改,则⼀定要对主脚本和ERwin diagram进⾏相应更新.3.2 Diagrams使⽤Visio进⾏数据diagram,流程图,服务器拓朴和其它diagrams进⾏设计.⽂档化系统或者处理流程可以⼤⼤有利于团队间的协作.3.3版本控制推荐使⽤Visual SourceSafe(VSS)对NESE数据库对象进⾏管理.在任何项⽬中,都应该有很好的代码更改控制,初始版本⽂件应该放到VSS中并被注释.所有对这些⽂件的后继更改都应该放到VSS中管理.3.4 源码⽬录结构在项⽬刚开始时,找到⼀个所有Team成员都能够访问的共享.按照以下结构初始化VSS⽬录和数据库⼦⽬录:\CMD 包括全系统脚本的脚本⽂件,如果是⼀个多数据库的系统,应该有⼀个可能创建所有数据库的命令⽂件.\DBName 在系统中的每个数据库应该有⾃⼰的⽬录结构,如下:\CMD:⽤来创建此数据库的脚本⽂件,并且来更改数据库构架.\DAT:⽤来刷新此数据库的数据⽂件.\SP:⽤来存储存储过程的脚本\TBL:除了下⾯⼦⽬录,这个⽬录应该包括表的定义脚本,每个表应该有它⾃⼰的脚本,此脚本应该包括经表的删除,创建语句,索引,触发器,完整性参照,Check约束,默认值约束等,每个表创建语句应该包括在不同的脚本中,并被把归类到类似于下⾯的相应的⼦⽬录中.注意:本⽬录中的脚本和以下⼦⽬录的脚本应该命名为它所影响的表名,⽐如:表名.sql:\Check:为每个表创建独⽴的Check约束定义脚本,Check约束应该使⽤alter table add constraint 来创建,并且每个altertable 语句只能包括⼀个contraint。
全国省份城市表(sql版)
全国省份城市表(sql版)
前段时间感觉现在正在⽤的全国省份/城市表不是太好,于是想换⼀个新的,没想到上⽹找了好久都没有找到合适的,于是上国家统计局⽹站上拷了⼀份最新的有关区域名称的本⽂回来,最后花半天时间整理了⼀下,终于改为⾃⼰想要的格式了,想到还有许多朋友想要⼀份这样的数据表,故现公布如下:
国家统计局的⽹址:
数据库表结构:
if exists (select*from dbo.sysobjects where id =object_id(N'[dbo].[Area]') and OBJECTPROPERTY(id, N'IsUserTable') =1)
drop table[dbo].[Area]
GO
CREATE TABLE[dbo].[Area] (
[AreaID][int]IDENTITY (1, 1) NOT NULL ,
[Name][nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ParentID][int]NULL
) ON[PRIMARY]
GO
ALTER TABLE[dbo].[Area]ADD
CONSTRAINT[PK_aa]PRIMARY KEY CLUSTERED
(
[AreaID]
) ON[PRIMARY]
GO
数据内容我已导出成txt格式,因为数据库⽂件太⼤了,默认的就有1M。
只要把下载的⽂件导⼊到前⾯建好的表中即可!
放⼀幅图出来look⼀look:。
sql表空间结构与页、区、段的定义
一、概述在数据库管理系统中,表空间是一种逻辑存储结构,用于组织和管理数据库中的数据。
在SQL中,表空间的概念是非常重要的,它可以影响到数据库的性能和存储结构。
本文将介绍SQL表空间的结构以及页、区、段的定义,帮助读者更好地理解和管理数据库。
二、SQL表空间的结构1. 表空间的概念在SQL中,表空间是用来存放数据库对象的一种逻辑结构。
每个数据库都包括一个或多个表空间,表空间包含了数据库中的表、索引、视图等对象。
通过表空间,可以有效地管理数据库的存储空间,并对数据进行组织和存储。
2. 表空间的组成表空间由多个数据文件组成,每个数据文件对应一个操作系统文件。
这些数据文件可以存放在不同的磁盘上,从而实现数据在多个磁盘上的分布存储。
表空间还包括了表和索引的存储结构定义,以及一系列的控制信息,用于管理和维护表空间中的数据。
3. 表空间的作用表空间的设计对数据库的性能和管理非常重要。
合理的表空间设计可以提高数据库的性能,减少空间的浪费,并且便于数据库的管理和维护。
通过表空间,可以对数据进行分区存储,将不同的数据存放在不同的表空间中,从而提高查询和管理效率。
三、页、区、段的定义1. 页的概念在数据库中,页是数据存储的最小单位。
每个数据文件被分成多个页,每个页的大小通常为4KB或8KB。
数据库将数据存储在页中,每个页可以存储一定大小的数据记录,数据按页的方式进行读写和管理。
2. 区的概念区是页的集合,用于组织和管理数据文件中的页。
数据库将一个数据文件划分为多个区,在每个区中存放了一定数量的页。
区的划分可以提高数据的存取效率,便于数据库对数据进行管理和优化。
3. 段的概念段是数据库中的逻辑存储单位,每个表和索引都包含一个或多个段。
段可以理解为表或索引在磁盘上的存储结构,它包括了数据文件和控制信息,用于管理和维护数据的存储。
数据库根据段来管理表和索引的存储、访问和维护。
四、结论通过本文的介绍,读者可以更好地理解SQL表空间的结构和页、区、段的定义。
查询表结构的sql语句
查询表结构的sql语句查询表结构的SQL语句是用来查看数据库中表的结构信息的命令。
通过执行这些SQL语句,可以获取表的字段、数据类型、约束、索引等详细信息。
下面列举了十个常用的查询表结构的SQL语句。
1. 查询指定表的所有字段和数据类型```sqlDESCRIBE table_name;```这条SQL语句将返回指定表的字段名、数据类型、是否允许为空、默认值等信息。
2. 查询指定表的所有字段和约束```sqlSHOW CREATE TABLE table_name;```这条SQL语句将返回指定表的字段名、数据类型、主键、外键、唯一约束等详细信息。
3. 查询指定表的主键```sqlSHOW KEYS FROM table_name WHERE Key_name = 'PRIMARY';```这条SQL语句将返回指定表的主键字段名。
4. 查询指定表的外键```sqlSELECTCONSTRAINT_NAME,COLUMN_NAME,REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAMEFROMINFORMATION_SCHEMA.KEY_COLUMN_USAGEWHERETABLE_NAME = 'table_name' ANDREFERENCED_TABLE_NAME IS NOT NULL;```这条SQL语句将返回指定表的外键约束名称、字段名、引用的表名和字段名。
5. 查询指定表的索引```sqlSHOW INDEX FROM table_name;```这条SQL语句将返回指定表的索引名称、索引类型、字段名等信息。
6. 查询指定表的注释```sqlSELECTTABLE_NAME,COLUMN_NAME,COLUMN_COMMENTFROMINFORMATION_SCHEMA.COLUMNSWHERETABLE_SCHEMA = 'database_name' ANDTABLE_NAME = 'table_name';```这条SQL语句将返回指定表的字段注释。
中国省市区----SQL表
中国省市区----SQL表[sql] view plain copy print?在CODE上查看代码⽚派⽣到我的代码⽚SET FOREIGN_KEY_CHECKS=0;-- ------------------------------ Table structure for rc_district-- ----------------------------DROP TABLE IF EXISTS `rc_district`;CREATE TABLE `rc_district` (`district_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '⾃增id',`pid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '⽗及关系',`district` varchar(120) NOT NULL DEFAULT '' COMMENT '地区名称',`level` tinyint(1) NOT NULL COMMENT '⼦属关系',PRIMARY KEY (`district_id`),KEY `parent_id` (`pid`),KEY `region_type` (`level`)) ENGINE=MyISAM AUTO_INCREMENT=3432 DEFAULT CHARSET=utf8 COMMENT='地区表';-- ------------------------------ Records of rc_district-- ----------------------------INSERT INTO `rc_district` VALUES ('1', '0', '中国', '0');INSERT INTO `rc_district` VALUES ('2', '1', '北京市', '1');INSERT INTO `rc_district` VALUES ('3', '1', '安徽省', '1');INSERT INTO `rc_district` VALUES ('4', '1', '福建省', '1');INSERT INTO `rc_district` VALUES ('5', '1', '⽢肃省', '1');INSERT INTO `rc_district` VALUES ('6', '1', '⼴东省', '1');INSERT INTO `rc_district` VALUES ('7', '1', '⼴西壮族⾃治区', '1');INSERT INTO `rc_district` VALUES ('8', '1', '贵州省', '1');INSERT INTO `rc_district` VALUES ('9', '1', '海南省', '1');INSERT INTO `rc_district` VALUES ('10', '1', '河北省', '1');INSERT INTO `rc_district` VALUES ('11', '1', '河南省', '1');INSERT INTO `rc_district` VALUES ('12', '1', '⿊龙江省', '1');INSERT INTO `rc_district` VALUES ('13', '1', '湖北省', '1');INSERT INTO `rc_district` VALUES ('14', '1', '湖南省', '1');INSERT INTO `rc_district` VALUES ('15', '1', '吉林省', '1');INSERT INTO `rc_district` VALUES ('16', '1', '江苏省', '1');INSERT INTO `rc_district` VALUES ('17', '1', '江西省', '1');INSERT INTO `rc_district` VALUES ('18', '1', '辽宁省', '1');INSERT INTO `rc_district` VALUES ('19', '1', '内蒙古⾃治区', '1');INSERT INTO `rc_district` VALUES ('20', '1', '宁夏回族⾃治区', '1');INSERT INTO `rc_district` VALUES ('21', '1', '青海省', '1');INSERT INTO `rc_district` VALUES ('22', '1', '⼭东省', '1');INSERT INTO `rc_district` VALUES ('23', '1', '⼭西省', '1');INSERT INTO `rc_district` VALUES ('24', '1', '陕西省', '1');INSERT INTO `rc_district` VALUES ('25', '1', '上海市', '1');INSERT INTO `rc_district` VALUES ('26', '1', '四川省', '1');INSERT INTO `rc_district` VALUES ('27', '1', '天津市', '1');INSERT INTO `rc_district` VALUES ('28', '1', '西藏⾃治区', '1');INSERT INTO `rc_district` VALUES ('29', '1', '新疆维吾尔⾃治区', '1');INSERT INTO `rc_district` VALUES ('30', '1', '云南省', '1');INSERT INTO `rc_district` VALUES ('31', '1', '浙江省', '1');INSERT INTO `rc_district` VALUES ('32', '1', '重庆市', '1');INSERT INTO `rc_district` VALUES ('33', '1', '⾹港特别⾏政区', '1');INSERT INTO `rc_district` VALUES ('34', '1', '澳门特别⾏政区', '1');INSERT INTO `rc_district` VALUES ('35', '1', '台湾省', '1');INSERT INTO `rc_district` VALUES ('36', '3', '安庆', '2');INSERT INTO `rc_district` VALUES ('37', '3', '蚌埠', '2');INSERT INTO `rc_district` VALUES ('38', '3', '巢湖', '2');INSERT INTO `rc_district` VALUES ('46', '3', '马鞍⼭', '2'); INSERT INTO `rc_district` VALUES ('47', '3', '宿州', '2'); INSERT INTO `rc_district` VALUES ('48', '3', '铜陵', '2'); INSERT INTO `rc_district` VALUES ('49', '3', '芜湖', '2'); INSERT INTO `rc_district` VALUES ('50', '3', '宣城', '2'); INSERT INTO `rc_district` VALUES ('51', '3', '亳州', '2'); INSERT INTO `rc_district` VALUES ('52', '2', '北京', '2'); INSERT INTO `rc_district` VALUES ('53', '4', '福州', '2'); INSERT INTO `rc_district` VALUES ('54', '4', '龙岩', '2'); INSERT INTO `rc_district` VALUES ('55', '4', '南平', '2'); INSERT INTO `rc_district` VALUES ('56', '4', '宁德', '2'); INSERT INTO `rc_district` VALUES ('57', '4', '莆⽥', '2'); INSERT INTO `rc_district` VALUES ('58', '4', '泉州', '2'); INSERT INTO `rc_district` VALUES ('59', '4', '三明', '2'); INSERT INTO `rc_district` VALUES ('60', '4', '厦门', '2'); INSERT INTO `rc_district` VALUES ('61', '4', '漳州', '2'); INSERT INTO `rc_district` VALUES ('62', '5', '兰州', '2'); INSERT INTO `rc_district` VALUES ('63', '5', '⽩银', '2'); INSERT INTO `rc_district` VALUES ('64', '5', '定西', '2'); INSERT INTO `rc_district` VALUES ('65', '5', '⽢南', '2'); INSERT INTO `rc_district` VALUES ('66', '5', '嘉峪关', '2'); INSERT INTO `rc_district` VALUES ('67', '5', '⾦昌', '2'); INSERT INTO `rc_district` VALUES ('68', '5', '酒泉', '2'); INSERT INTO `rc_district` VALUES ('69', '5', '临夏', '2'); INSERT INTO `rc_district` VALUES ('70', '5', '陇南', '2'); INSERT INTO `rc_district` VALUES ('71', '5', '平凉', '2'); INSERT INTO `rc_district` VALUES ('72', '5', '庆阳', '2'); INSERT INTO `rc_district` VALUES ('73', '5', '天⽔', '2'); INSERT INTO `rc_district` VALUES ('74', '5', '武威', '2'); INSERT INTO `rc_district` VALUES ('75', '5', '张掖', '2'); INSERT INTO `rc_district` VALUES ('76', '6', '⼴州', '2'); INSERT INTO `rc_district` VALUES ('77', '6', '深圳', '2'); INSERT INTO `rc_district` VALUES ('78', '6', '潮州', '2'); INSERT INTO `rc_district` VALUES ('79', '6', '东莞', '2'); INSERT INTO `rc_district` VALUES ('80', '6', '佛⼭', '2'); INSERT INTO `rc_district` VALUES ('81', '6', '河源', '2'); INSERT INTO `rc_district` VALUES ('82', '6', '惠州', '2'); INSERT INTO `rc_district` VALUES ('83', '6', '江门', '2'); INSERT INTO `rc_district` VALUES ('84', '6', '揭阳', '2'); INSERT INTO `rc_district` VALUES ('85', '6', '茂名', '2'); INSERT INTO `rc_district` VALUES ('86', '6', '梅州', '2'); INSERT INTO `rc_district` VALUES ('87', '6', '清远', '2'); INSERT INTO `rc_district` VALUES ('88', '6', '汕头', '2'); INSERT INTO `rc_district` VALUES ('89', '6', '汕尾', '2'); INSERT INTO `rc_district` VALUES ('90', '6', '韶关', '2'); INSERT INTO `rc_district` VALUES ('91', '6', '阳江', '2'); INSERT INTO `rc_district` VALUES ('92', '6', '云浮', '2'); INSERT INTO `rc_district` VALUES ('93', '6', '湛江', '2'); INSERT INTO `rc_district` VALUES ('94', '6', '肇庆', '2'); INSERT INTO `rc_district` VALUES ('95', '6', '中⼭', '2'); INSERT INTO `rc_district` VALUES ('96', '6', '珠海', '2'); INSERT INTO `rc_district` VALUES ('97', '7', '南宁', '2'); INSERT INTO `rc_district` VALUES ('98', '7', '桂林', '2'); INSERT INTO `rc_district` VALUES ('99', '7', '百⾊', '2'); INSERT INTO `rc_district` VALUES ('100', '7', '北海', '2'); INSERT INTO `rc_district` VALUES ('101', '7', '崇左', '2'); INSERT INTO `rc_district` VALUES ('102', '7', '防城港', '2'); INSERT INTO `rc_district` VALUES ('103', '7', '贵港', '2');INSERT INTO `rc_district` VALUES ('111', '8', '贵阳', '2'); INSERT INTO `rc_district` VALUES ('112', '8', '安顺', '2'); INSERT INTO `rc_district` VALUES ('113', '8', '毕节', '2'); INSERT INTO `rc_district` VALUES ('114', '8', '六盘⽔', '2'); INSERT INTO `rc_district` VALUES ('115', '8', '黔东南', '2'); INSERT INTO `rc_district` VALUES ('116', '8', '黔南', '2'); INSERT INTO `rc_district` VALUES ('117', '8', '黔西南', '2'); INSERT INTO `rc_district` VALUES ('118', '8', '铜仁', '2'); INSERT INTO `rc_district` VALUES ('119', '8', '遵义', '2'); INSERT INTO `rc_district` VALUES ('120', '9', '海⼝', '2'); INSERT INTO `rc_district` VALUES ('121', '9', '三亚', '2'); INSERT INTO `rc_district` VALUES ('122', '9', '⽩沙', '2'); INSERT INTO `rc_district` VALUES ('123', '9', '保亭', '2'); INSERT INTO `rc_district` VALUES ('124', '9', '昌江', '2'); INSERT INTO `rc_district` VALUES ('125', '9', '澄迈县', '2'); INSERT INTO `rc_district` VALUES ('126', '9', '定安县', '2'); INSERT INTO `rc_district` VALUES ('127', '9', '东⽅', '2'); INSERT INTO `rc_district` VALUES ('128', '9', '乐东', '2'); INSERT INTO `rc_district` VALUES ('129', '9', '临⾼县', '2'); INSERT INTO `rc_district` VALUES ('130', '9', '陵⽔', '2'); INSERT INTO `rc_district` VALUES ('131', '9', '琼海', '2'); INSERT INTO `rc_district` VALUES ('132', '9', '琼中', '2'); INSERT INTO `rc_district` VALUES ('133', '9', '屯昌县', '2'); INSERT INTO `rc_district` VALUES ('134', '9', '万宁', '2'); INSERT INTO `rc_district` VALUES ('135', '9', '⽂昌', '2'); INSERT INTO `rc_district` VALUES ('136', '9', '五指⼭', '2'); INSERT INTO `rc_district` VALUES ('137', '9', '儋州', '2'); INSERT INTO `rc_district` VALUES ('138', '10', '⽯家庄', '2'); INSERT INTO `rc_district` VALUES ('139', '10', '保定', '2'); INSERT INTO `rc_district` VALUES ('140', '10', '沧州', '2'); INSERT INTO `rc_district` VALUES ('141', '10', '承德', '2'); INSERT INTO `rc_district` VALUES ('142', '10', '邯郸', '2'); INSERT INTO `rc_district` VALUES ('143', '10', '衡⽔', '2'); INSERT INTO `rc_district` VALUES ('144', '10', '廊坊', '2'); INSERT INTO `rc_district` VALUES ('145', '10', '秦皇岛', '2'); INSERT INTO `rc_district` VALUES ('146', '10', '唐⼭', '2'); INSERT INTO `rc_district` VALUES ('147', '10', '邢台', '2'); INSERT INTO `rc_district` VALUES ('148', '10', '张家⼝', '2'); INSERT INTO `rc_district` VALUES ('149', '11', '郑州', '2'); INSERT INTO `rc_district` VALUES ('150', '11', '洛阳', '2'); INSERT INTO `rc_district` VALUES ('151', '11', '开封', '2'); INSERT INTO `rc_district` VALUES ('152', '11', '安阳', '2'); INSERT INTO `rc_district` VALUES ('153', '11', '鹤壁', '2'); INSERT INTO `rc_district` VALUES ('154', '11', '济源', '2'); INSERT INTO `rc_district` VALUES ('155', '11', '焦作', '2'); INSERT INTO `rc_district` VALUES ('156', '11', '南阳', '2'); INSERT INTO `rc_district` VALUES ('157', '11', '平顶⼭', '2'); INSERT INTO `rc_district` VALUES ('158', '11', '三门峡', '2'); INSERT INTO `rc_district` VALUES ('159', '11', '商丘', '2'); INSERT INTO `rc_district` VALUES ('160', '11', '新乡', '2'); INSERT INTO `rc_district` VALUES ('161', '11', '信阳', '2'); INSERT INTO `rc_district` VALUES ('162', '11', '许昌', '2'); INSERT INTO `rc_district` VALUES ('163', '11', '周⼝', '2'); INSERT INTO `rc_district` VALUES ('164', '11', '驻马店', '2'); INSERT INTO `rc_district` VALUES ('165', '11', '漯河', '2'); INSERT INTO `rc_district` VALUES ('166', '11', '濮阳', '2'); INSERT INTO `rc_district` VALUES ('167', '12', '哈尔滨', '2'); INSERT INTO `rc_district` VALUES ('168', '12', '⼤庆', '2');INSERT INTO `rc_district` VALUES ('176', '12', '齐齐哈尔', '2'); INSERT INTO `rc_district` VALUES ('177', '12', '双鸭⼭', '2'); INSERT INTO `rc_district` VALUES ('178', '12', '绥化', '2'); INSERT INTO `rc_district` VALUES ('179', '12', '伊春', '2'); INSERT INTO `rc_district` VALUES ('180', '13', '武汉', '2'); INSERT INTO `rc_district` VALUES ('181', '13', '仙桃', '2'); INSERT INTO `rc_district` VALUES ('182', '13', '鄂州', '2'); INSERT INTO `rc_district` VALUES ('183', '13', '黄冈', '2'); INSERT INTO `rc_district` VALUES ('184', '13', '黄⽯', '2'); INSERT INTO `rc_district` VALUES ('185', '13', '荆门', '2'); INSERT INTO `rc_district` VALUES ('186', '13', '荆州', '2'); INSERT INTO `rc_district` VALUES ('187', '13', '潜江', '2'); INSERT INTO `rc_district` VALUES ('188', '13', '神农架林区', '2'); INSERT INTO `rc_district` VALUES ('189', '13', '⼗堰', '2'); INSERT INTO `rc_district` VALUES ('190', '13', '随州', '2'); INSERT INTO `rc_district` VALUES ('191', '13', '天门', '2'); INSERT INTO `rc_district` VALUES ('192', '13', '咸宁', '2'); INSERT INTO `rc_district` VALUES ('193', '13', '襄樊', '2'); INSERT INTO `rc_district` VALUES ('194', '13', '孝感', '2'); INSERT INTO `rc_district` VALUES ('195', '13', '宜昌', '2'); INSERT INTO `rc_district` VALUES ('196', '13', '恩施', '2'); INSERT INTO `rc_district` VALUES ('197', '14', '长沙', '2'); INSERT INTO `rc_district` VALUES ('198', '14', '张家界', '2'); INSERT INTO `rc_district` VALUES ('199', '14', '常德', '2'); INSERT INTO `rc_district` VALUES ('200', '14', '郴州', '2'); INSERT INTO `rc_district` VALUES ('201', '14', '衡阳', '2'); INSERT INTO `rc_district` VALUES ('202', '14', '怀化', '2'); INSERT INTO `rc_district` VALUES ('203', '14', '娄底', '2'); INSERT INTO `rc_district` VALUES ('204', '14', '邵阳', '2'); INSERT INTO `rc_district` VALUES ('205', '14', '湘潭', '2'); INSERT INTO `rc_district` VALUES ('206', '14', '湘西', '2'); INSERT INTO `rc_district` VALUES ('207', '14', '益阳', '2'); INSERT INTO `rc_district` VALUES ('208', '14', '永州', '2'); INSERT INTO `rc_district` VALUES ('209', '14', '岳阳', '2'); INSERT INTO `rc_district` VALUES ('210', '14', '株洲', '2'); INSERT INTO `rc_district` VALUES ('211', '15', '长春', '2'); INSERT INTO `rc_district` VALUES ('212', '15', '吉林', '2'); INSERT INTO `rc_district` VALUES ('213', '15', '⽩城', '2'); INSERT INTO `rc_district` VALUES ('214', '15', '⽩⼭', '2'); INSERT INTO `rc_district` VALUES ('215', '15', '辽源', '2'); INSERT INTO `rc_district` VALUES ('216', '15', '四平', '2'); INSERT INTO `rc_district` VALUES ('217', '15', '松原', '2'); INSERT INTO `rc_district` VALUES ('218', '15', '通化', '2'); INSERT INTO `rc_district` VALUES ('219', '15', '延边', '2'); INSERT INTO `rc_district` VALUES ('220', '16', '南京', '2'); INSERT INTO `rc_district` VALUES ('221', '16', '苏州', '2'); INSERT INTO `rc_district` VALUES ('222', '16', '⽆锡', '2'); INSERT INTO `rc_district` VALUES ('223', '16', '常州', '2'); INSERT INTO `rc_district` VALUES ('224', '16', '淮安', '2'); INSERT INTO `rc_district` VALUES ('225', '16', '连云港', '2'); INSERT INTO `rc_district` VALUES ('226', '16', '南通', '2'); INSERT INTO `rc_district` VALUES ('227', '16', '宿迁', '2'); INSERT INTO `rc_district` VALUES ('228', '16', '泰州', '2'); INSERT INTO `rc_district` VALUES ('229', '16', '徐州', '2'); INSERT INTO `rc_district` VALUES ('230', '16', '盐城', '2'); INSERT INTO `rc_district` VALUES ('231', '16', '扬州', '2'); INSERT INTO `rc_district` VALUES ('232', '16', '镇江', '2'); INSERT INTO `rc_district` VALUES ('233', '17', '南昌', '2');INSERT INTO `rc_district` VALUES ('242', '17', '宜春', '2'); INSERT INTO `rc_district` VALUES ('243', '17', '鹰潭', '2'); INSERT INTO `rc_district` VALUES ('244', '18', '沈阳', '2'); INSERT INTO `rc_district` VALUES ('245', '18', '⼤连', '2'); INSERT INTO `rc_district` VALUES ('246', '18', '鞍⼭', '2'); INSERT INTO `rc_district` VALUES ('247', '18', '本溪', '2'); INSERT INTO `rc_district` VALUES ('248', '18', '朝阳', '2'); INSERT INTO `rc_district` VALUES ('249', '18', '丹东', '2'); INSERT INTO `rc_district` VALUES ('250', '18', '抚顺', '2'); INSERT INTO `rc_district` VALUES ('251', '18', '⾩新', '2'); INSERT INTO `rc_district` VALUES ('252', '18', '葫芦岛', '2'); INSERT INTO `rc_district` VALUES ('253', '18', '锦州', '2'); INSERT INTO `rc_district` VALUES ('254', '18', '辽阳', '2'); INSERT INTO `rc_district` VALUES ('255', '18', '盘锦', '2'); INSERT INTO `rc_district` VALUES ('256', '18', '铁岭', '2'); INSERT INTO `rc_district` VALUES ('257', '18', '营⼝', '2'); INSERT INTO `rc_district` VALUES ('258', '19', '呼和浩特', '2'); INSERT INTO `rc_district` VALUES ('259', '19', '阿拉善盟', '2'); INSERT INTO `rc_district` VALUES ('260', '19', '巴彦淖尔盟', '2'); INSERT INTO `rc_district` VALUES ('261', '19', '包头', '2'); INSERT INTO `rc_district` VALUES ('262', '19', '⾚峰', '2'); INSERT INTO `rc_district` VALUES ('263', '19', '鄂尔多斯', '2'); INSERT INTO `rc_district` VALUES ('264', '19', '呼伦贝尔', '2'); INSERT INTO `rc_district` VALUES ('265', '19', '通辽', '2'); INSERT INTO `rc_district` VALUES ('266', '19', '乌海', '2'); INSERT INTO `rc_district` VALUES ('267', '19', '乌兰察布市', '2'); INSERT INTO `rc_district` VALUES ('268', '19', '锡林郭勒盟', '2'); INSERT INTO `rc_district` VALUES ('269', '19', '兴安盟', '2'); INSERT INTO `rc_district` VALUES ('270', '20', '银川', '2'); INSERT INTO `rc_district` VALUES ('271', '20', '固原', '2'); INSERT INTO `rc_district` VALUES ('272', '20', '⽯嘴⼭', '2'); INSERT INTO `rc_district` VALUES ('273', '20', '吴忠', '2'); INSERT INTO `rc_district` VALUES ('274', '20', '中卫', '2'); INSERT INTO `rc_district` VALUES ('275', '21', '西宁', '2'); INSERT INTO `rc_district` VALUES ('276', '21', '果洛', '2'); INSERT INTO `rc_district` VALUES ('277', '21', '海北', '2'); INSERT INTO `rc_district` VALUES ('278', '21', '海东', '2'); INSERT INTO `rc_district` VALUES ('279', '21', '海南', '2'); INSERT INTO `rc_district` VALUES ('280', '21', '海西', '2'); INSERT INTO `rc_district` VALUES ('281', '21', '黄南', '2'); INSERT INTO `rc_district` VALUES ('282', '21', '⽟树', '2'); INSERT INTO `rc_district` VALUES ('283', '22', '济南', '2'); INSERT INTO `rc_district` VALUES ('284', '22', '青岛', '2'); INSERT INTO `rc_district` VALUES ('285', '22', '滨州', '2'); INSERT INTO `rc_district` VALUES ('286', '22', '德州', '2'); INSERT INTO `rc_district` VALUES ('287', '22', '东营', '2'); INSERT INTO `rc_district` VALUES ('288', '22', '菏泽', '2'); INSERT INTO `rc_district` VALUES ('289', '22', '济宁', '2'); INSERT INTO `rc_district` VALUES ('290', '22', '莱芜', '2'); INSERT INTO `rc_district` VALUES ('291', '22', '聊城', '2'); INSERT INTO `rc_district` VALUES ('292', '22', '临沂', '2'); INSERT INTO `rc_district` VALUES ('293', '22', '⽇照', '2'); INSERT INTO `rc_district` VALUES ('294', '22', '泰安', '2'); INSERT INTO `rc_district` VALUES ('295', '22', '威海', '2'); INSERT INTO `rc_district` VALUES ('296', '22', '潍坊', '2'); INSERT INTO `rc_district` VALUES ('297', '22', '烟台', '2'); INSERT INTO `rc_district` VALUES ('298', '22', '枣庄', '2');INSERT INTO `rc_district` VALUES ('307', '23', '朔州', '2'); INSERT INTO `rc_district` VALUES ('308', '23', '忻州', '2'); INSERT INTO `rc_district` VALUES ('309', '23', '阳泉', '2'); INSERT INTO `rc_district` VALUES ('310', '23', '运城', '2'); INSERT INTO `rc_district` VALUES ('311', '24', '西安', '2'); INSERT INTO `rc_district` VALUES ('312', '24', '安康', '2'); INSERT INTO `rc_district` VALUES ('313', '24', '宝鸡', '2'); INSERT INTO `rc_district` VALUES ('314', '24', '汉中', '2'); INSERT INTO `rc_district` VALUES ('315', '24', '商洛', '2'); INSERT INTO `rc_district` VALUES ('316', '24', '铜川', '2'); INSERT INTO `rc_district` VALUES ('317', '24', '渭南', '2'); INSERT INTO `rc_district` VALUES ('318', '24', '咸阳', '2'); INSERT INTO `rc_district` VALUES ('319', '24', '延安', '2'); INSERT INTO `rc_district` VALUES ('320', '24', '榆林', '2'); INSERT INTO `rc_district` VALUES ('321', '25', '上海', '2'); INSERT INTO `rc_district` VALUES ('322', '26', '成都', '2'); INSERT INTO `rc_district` VALUES ('323', '26', '绵阳', '2'); INSERT INTO `rc_district` VALUES ('324', '26', '阿坝', '2'); INSERT INTO `rc_district` VALUES ('325', '26', '巴中', '2'); INSERT INTO `rc_district` VALUES ('326', '26', '达州', '2'); INSERT INTO `rc_district` VALUES ('327', '26', '德阳', '2'); INSERT INTO `rc_district` VALUES ('328', '26', '⽢孜', '2'); INSERT INTO `rc_district` VALUES ('329', '26', '⼴安', '2'); INSERT INTO `rc_district` VALUES ('330', '26', '⼴元', '2'); INSERT INTO `rc_district` VALUES ('331', '26', '乐⼭', '2'); INSERT INTO `rc_district` VALUES ('332', '26', '凉⼭', '2'); INSERT INTO `rc_district` VALUES ('333', '26', '眉⼭', '2'); INSERT INTO `rc_district` VALUES ('334', '26', '南充', '2'); INSERT INTO `rc_district` VALUES ('335', '26', '内江', '2'); INSERT INTO `rc_district` VALUES ('336', '26', '攀枝花', '2'); INSERT INTO `rc_district` VALUES ('337', '26', '遂宁', '2'); INSERT INTO `rc_district` VALUES ('338', '26', '雅安', '2'); INSERT INTO `rc_district` VALUES ('339', '26', '宜宾', '2'); INSERT INTO `rc_district` VALUES ('340', '26', '资阳', '2'); INSERT INTO `rc_district` VALUES ('341', '26', '⾃贡', '2'); INSERT INTO `rc_district` VALUES ('342', '26', '泸州', '2'); INSERT INTO `rc_district` VALUES ('343', '27', '天津', '2'); INSERT INTO `rc_district` VALUES ('344', '28', '拉萨', '2'); INSERT INTO `rc_district` VALUES ('345', '28', '阿⾥', '2'); INSERT INTO `rc_district` VALUES ('346', '28', '昌都', '2'); INSERT INTO `rc_district` VALUES ('347', '28', '林芝', '2'); INSERT INTO `rc_district` VALUES ('348', '28', '那曲', '2'); INSERT INTO `rc_district` VALUES ('349', '28', '⽇喀则', '2'); INSERT INTO `rc_district` VALUES ('350', '28', '⼭南', '2'); INSERT INTO `rc_district` VALUES ('351', '29', '乌鲁⽊齐', '2'); INSERT INTO `rc_district` VALUES ('352', '29', '阿克苏', '2'); INSERT INTO `rc_district` VALUES ('353', '29', '阿拉尔', '2'); INSERT INTO `rc_district` VALUES ('354', '29', '巴⾳郭楞', '2'); INSERT INTO `rc_district` VALUES ('355', '29', '博尔塔拉', '2'); INSERT INTO `rc_district` VALUES ('356', '29', '昌吉', '2'); INSERT INTO `rc_district` VALUES ('357', '29', '哈密', '2'); INSERT INTO `rc_district` VALUES ('358', '29', '和⽥', '2'); INSERT INTO `rc_district` VALUES ('359', '29', '喀什', '2'); INSERT INTO `rc_district` VALUES ('360', '29', '克拉玛依', '2'); INSERT INTO `rc_district` VALUES ('361', '29', '克孜勒苏', '2'); INSERT INTO `rc_district` VALUES ('362', '29', '⽯河⼦', '2'); INSERT INTO `rc_district` VALUES ('363', '29', '图⽊舒克', '2');。
查表结构的sql语句
查表结构的sql语句查表结构的SQL语句引言•简要介绍查表结构的SQL语句的重要性•提出本文将详细介绍的主题为什么需要查表结构的SQL语句•解释查表结构的目的和意义•强调在开发和维护数据库时的重要性常用的查表结构的SQL语句1.SHOW TABLES;–介绍SHOW TABLES语句的作用和使用方法–示例代码和结果展示2.DESCRIBE table_name;–说明DESCRIBE语句的用途和应用场景–使用示例和输出解读3.SHOW COLUMNS FROM table_name;–解释SHOW COLUMNS语句的作用和适用性–提供实际案例和结果解释4.SELECT * FROM information_ WHERE table_schema =‘database_name’ AND table_name = ‘table_name’;–具体介绍information_schema表和相关列的用法–指导读者如何根据自己的需要进行修改和过滤其他相关内容•列举其他查表结构的SQL语句,如SHOW INDEX等•提供相关的知识扩展或进一步阅读的建议•强调在实际工作中的注意事项和常见问题结论•总结查表结构的SQL语句的重要性和使用方法•鼓励读者在数据库开发和维护中充分利用这些语句•结束语和致谢引言在数据库开发和维护过程中,了解和操作数据表的结构是至关重要的。
通过查表结构的SQL语句,我们能够快速获取表的字段、类型、索引等信息,从而更好地进行数据库设计、查询优化和问题排查。
本文将详细介绍常用的查表结构的SQL语句,帮助读者掌握这些工具的使用方法和注意事项。
为什么需要查表结构的SQL语句在数据库开发和维护中,我们经常需要了解表的结构信息,例如字段名、数据类型、索引等。
这些信息对于数据库设计、性能优化和故障排查都是至关重要的。
通过查表结构的SQL语句,我们可以快速获取这些关键信息,更高效地进行数据库操作和维护工作。
省市县级联查询sql详解
3、查询所有的省会城市 1 SELECT F_REGION_NUM, F_REGION_NAME, F_IS_USE, F_JBBM, F_JB, F_MJ 2 FROM TB_DA_AREA T 3 WHERE 1 = 1 4 AND T.F_IS_USE = 1 5 AND T.F_JB = 1 6 AND T.F_MJ = 0
4、业务场景:查询江苏省下的省会城市(主要利用的是江苏省的F_JBBM:32、级别变为:2) 1 SELECT F_REGION_NUM, F_REGION_NAME, F_IS_USE, F_JBBM, F_JB, F_MJ 2 FROM TB_DA_AREA T 3 WHERE 1 = 1 4 AND T.F_IS_USE = 1 5 AND T.F_JB = 2 6 AND T.F_MJ = 0 7 AND T.F_JBBM LIKE '32%'
5、查询南京市下的辖区信息(最后一级了所以末级数据为1传递南京市的级别编码) 1 SELECT F_REGION_NUM, F_REGION_NAME, F_IS_USE, F_JBBM, F_JB, F_MJ 2 FROM TB_DA_AREA T 3 WHERE 1 = 1 4 AND T.F_IS_USE = 1 5 AND T.F_JB = 3 6 AND T.F_MJ = 1 7 AND T.F_JBBM LIKE '3201%'
其他市区查询一致,只是传递的参数值不同而已,具来自在代码中的应用后期有时间在发布
oracle查询表结构sql语句
oracle查询表结构sql语句1. 查询表结构的SQL语句在Oracle数据库中,可以使用以下SQL语句查询表的结构信息:1.1. 查询所有表的结构```SELECT owner, table_name, column_name, data_type, data_length, nullableFROM all_tab_columnsORDER BY owner, table_name, column_id;```该语句会返回所有表的所有列的结构信息,包括所属用户(owner)、表名(table_name)、列名(column_name)、数据类型(data_type)、数据长度(data_length)和是否可为空(nullable)等。
1.2. 查询指定表的结构```SELECT column_name, data_type, data_length, nullableFROM all_tab_columnsWHERE owner = 'SCHEMA_NAME' AND table_name = 'TABLE_NAME' ORDER BY column_id;```将上述语句中的'SCHEMA_NAME'替换为要查询表所属的用户,'TABLE_NAME'替换为要查询的表名,可以获取指定表的结构信息。
1.3. 查询表的主键信息```SELECT cols.table_name, cols.column_name, cons.constraint_nameFROM all_constraints cons, all_cons_columns colsWHERE cons.constraint_type = 'P'AND cons.constraint_name = cols.constraint_nameAND cons.owner = cols.ownerAND cols.table_name = 'TABLE_NAME'AND cols.owner = 'SCHEMA_NAME';```将上述语句中的'SCHEMA_NAME'替换为要查询表所属的用户,'TABLE_NAME'替换为要查询的表名,可以获取指定表的主键信息。
sql 数据库 省市区 数据建表和数据
-- 表的结构areaDROP TABLE area;CREATE TABLE area(id int NOT NULL,areaID int NOT NULL,area varchar(200)NOT NULL,fatherID int NOT NULL,PRIMARY KEY (id))DROP TABLE city;CREATE TABLE city(id int NOT NULL,cityID int NOT NULL,city varchar(200)NOT NULL,fatherID int NOT NULL,PRIMARY KEY (id))---- 导出表中的数据city---- ------------------------------------------------------------ 表的结构province--DROP TABLE province;CREATE TABLE province(id int NOT NULL,provinceID int NOT NULL,province varchar(200)NOT NULL,PRIMARY KEY (id))insert province(id,provinceID,province)select 1,110000,'北京市'unionselect 2,120000,'天津市'unionselect 3,130000,'河北省'unionselect 4,140000,'山西省'unionselect 5,150000,'内蒙古自治区'union select 6,210000,'辽宁省'unionselect 7,220000,'吉林省'unionselect 8,230000,'黑龙江省'unionselect 9,310000,'上海市'unionselect 10,320000,'江苏省'unionselect 11,330000,'浙江省'unionselect 12,340000,'安徽省'unionselect 13,350000,'福建省'unionselect 14,360000,'江西省'unionselect 15,370000,'山东省'unionselect 16,410000,'河南省'unionselect 17,420000,'湖北省'unionselect 18,430000,'湖南省'unionselect 19,440000,'广东省'unionselect 20,450000,'广西壮族自治区'union select 21,460000,'海南省'unionselect 22,500000,'重庆市'unionselect 23,510000,'四川省'unionselect 24,520000,'贵州省'unionselect 25,530000,'云南省'unionselect 26,540000,'西藏自治区'union select 27,610000,'陕西省'unionselect 28,620000,'甘肃省'unionselect 29,630000,'青海省'unionselect 30,640000,'宁夏回族自治区'union select 31,650000,'新疆维吾尔自治区'union select 32,710000,'台湾省'unionselect 33,810000,'香港特别行政区'union select 34,820000,'澳门特别行政区'INSERT city(id,cityID,city,fatherID) select 1,110100,'市辖区',110000 union select 2,110200,'县',110000 unionselect 3,120100,'市辖区',120000 union select 4,120200,'县',120000 unionselect 5,130100,'石家庄市',130000 union select 6,130200,'唐山市',130000 union select 7,130300,'秦皇岛市',130000 union select 8,130400,'邯郸市',130000 union select 9,130500,'邢台市',130000 union select 10,130600,'保定市',130000 unionselect 12,130800,'承德市',130000 union select 13,130900,'沧州市',130000 union select 14,131000,'廊坊市',130000 union select 15,131100,'衡水市',130000 union select 16,140100,'太原市',140000 union select 17,140200,'大同市',140000 union select 18,140300,'阳泉市',140000 union select 19,140400,'长治市',140000 union select 20,140500,'晋城市',140000 union select 21,140600,'朔州市',140000 union select 22,140700,'晋中市',140000 union select 23,140800,'运城市',140000 union select 24,140900,'忻州市',140000 union select 25,141000,'临汾市',140000 union select 26,141100,'吕梁市',140000INSERT city(id,cityID,city,fatherID) select 27,150100,'呼和浩特市',150000 union select 28,150200,'包头市',150000 union select 29,150300,'乌海市',150000 union select 30,150400,'赤峰市',150000 union select 31,150500,'通辽市',150000 union select 32,150600,'鄂尔多斯市',150000 union select 33,150700,'呼伦贝尔市',150000 union select 34,150800,'巴彦淖尔市',150000 union select 35,150900,'乌兰察布市',150000 union select 36,152200,'兴安盟',150000 union select 37,152500,'锡林郭勒盟',150000 union select 38,152900,'阿拉善盟',150000 union select 39,210100,'沈阳市',210000 union select 40,210200,'大连市',210000 union select 41,210300,'鞍山市',210000 union select 42,210400,'抚顺市',210000 union select 43,210500,'本溪市',210000 union select 44,210600,'丹东市',210000 union select 45,210700,'锦州市',210000 union select 46,210800,'营口市',210000 union select 47,210900,'阜新市',210000 union select 48,211000,'辽阳市',210000 union select 49,211100,'盘锦市',210000 union select 50,211200,'铁岭市',210000 union select 51,211300,'朝阳市',210000 unionselect 53,220100,'长春市',220000 unionselect 54,220200,'吉林市',220000 unionselect 55,220300,'四平市',220000 unionselect 56,220400,'辽源市',220000 unionselect 57,220500,'通化市',220000 unionselect 58,220600,'白山市',220000 unionselect 59,220700,'松原市',220000 unionselect 60,220800,'白城市',220000 unionselect 61,222400,'延边朝鲜族自治州',220000 union select 62,230100,'哈尔滨市',230000 unionselect 63,230200,'齐齐哈尔市',230000 union select 64,230300,'鸡西市',230000 unionselect 65,230400,'鹤岗市',230000 unionselect 66,230500,'双鸭山市',230000 unionselect 67,230600,'大庆市',230000 unionselect 68,230700,'伊春市',230000 unionselect 69,230800,'佳木斯市',230000 unionselect 70,230900,'七台河市',230000 unionselect 71,231000,'牡丹江市',230000 unionselect 72,231100,'黑河市',230000 unionselect 73,231200,'绥化市',230000 unionselect 74,232700,'大兴安岭地区',230000 union select 75,310100,'市辖区',310000 unionselect 76,310200,'县',310000 unionselect 77,320100,'南京市',320000 unionselect 78,320200,'无锡市',320000 unionselect 79,320300,'徐州市',320000 unionselect 80,320400,'常州市',320000 unionselect 81,320500,'苏州市',320000 unionselect 82,320600,'南通市',320000 unionselect 83,320700,'连云港市',320000 unionselect 84,320800,'淮安市',320000 unionselect 85,320900,'盐城市',320000 unionselect 86,321000,'扬州市',320000 unionselect 87,321100,'镇江市',320000 unionselect 88,321200,'泰州市',320000 unionselect 89,321300,'宿迁市',320000 unionselect 90,330100,'杭州市',330000 unionselect 91,330200,'宁波市',330000 unionselect 92,330300,'温州市',330000 unionselect 93,330400,'嘉兴市',330000 unionselect 94,330500,'湖州市',330000 unionselect 95,330600,'绍兴市',330000 unionselect 97,330800,'衢州市',330000 union select 98,330900,'舟山市',330000 union select 99,331000,'台州市',330000 union select 100,331100,'丽水市',330000 union select 101,340100,'合肥市',340000 union select 102,340200,'芜湖市',340000 union select 103,340300,'蚌埠市',340000 union select 104,340400,'淮南市',340000 union select 105,340500,'马鞍山市',340000 union select 106,340600,'淮北市',340000 union select 107,340700,'铜陵市',340000 union select 108,340800,'安庆市',340000 union select 109,341000,'黄山市',340000 union select 110,341100,'滁州市',340000 union select 111,341200,'阜阳市',340000 union select 112,341300,'宿州市',340000 union select 113,341400,'巢湖市',340000 union select 114,341500,'六安市',340000 union select 115,341600,'亳州市',340000 union select 116,341700,'池州市',340000 union select 117,341800,'宣城市',340000 union select 118,350100,'福州市',350000 union select 119,350200,'厦门市',350000 union select 120,350300,'莆田市',350000 union select 121,350400,'三明市',350000 union select 122,350500,'泉州市',350000 union select 123,350600,'漳州市',350000 union select 124,350700,'南平市',350000 union select 125,350800,'龙岩市',350000 union select 126,350900,'宁德市',350000INSERT city(id,cityID,city,fatherID) select 127,360100,'南昌市',360000 union select 128,360200,'景德镇市',360000 union select 129,360300,'萍乡市',360000 union select 130,360400,'九江市',360000 union select 131,360500,'新余市',360000 union select 132,360600,'鹰潭市',360000 union select 133,360700,'赣州市',360000 union select 134,360800,'吉安市',360000 union select 135,360900,'宜春市',360000 union select 136,361000,'抚州市',360000 union select 137,361100,'上饶市',360000 unionselect 139,370200,'青岛市',370000 union select 140,370300,'淄博市',370000 union select 141,370400,'枣庄市',370000 union select 142,370500,'东营市',370000 union select 143,370600,'烟台市',370000 union select 144,370700,'潍坊市',370000 union select 145,370800,'济宁市',370000 union select 146,370900,'泰安市',370000 union select 147,371000,'威海市',370000 union select 148,371100,'日照市',370000 union select 149,371200,'莱芜市',370000 union select 150,371300,'临沂市',370000 union select 151,371400,'德州市',370000 union select 152,371500,'聊城市',370000 union select 153,371600,'滨州市',370000 union select 154,371700,'荷泽市',370000 union select 155,410100,'郑州市',410000 union select 156,410200,'开封市',410000 union select 157,410300,'洛阳市',410000 union select 158,410400,'平顶山市',410000 union select 159,410500,'安阳市',410000 union select 160,410600,'鹤壁市',410000 union select 161,410700,'新乡市',410000 union select 162,410800,'焦作市',410000 union select 163,410900,'濮阳市',410000 union select 164,411000,'许昌市',410000 union select 165,411100,'漯河市',410000 union select 166,411200,'三门峡市',410000 union select 167,411300,'南阳市',410000 union select 168,411400,'商丘市',410000 union select 169,411500,'信阳市',410000 union select 170,411600,'周口市',410000 union select 171,411700,'驻马店市',410000INSERT city(id,cityID,city,fatherID) select 172,420100,'武汉市',420000 union select 173,420200,'黄石市',420000 union select 174,420300,'十堰市',420000 union select 175,420500,'宜昌市',420000 union select 176,420600,'襄樊市',420000 union select 177,420700,'鄂州市',420000 union select 178,420800,'荆门市',420000 unionselect 180,421000,'荆州市',420000 unionselect 181,421100,'黄冈市',420000 unionselect 182,421200,'咸宁市',420000 unionselect 183,421300,'随州市',420000 unionselect 184,422800,'恩施土家族苗族自治州',420000 union select 185,429000,'省直辖行政单位',420000 union select 186,430100,'长沙市',430000 unionselect 187,430200,'株洲市',430000 unionselect 188,430300,'湘潭市',430000 unionselect 189,430400,'衡阳市',430000 unionselect 190,430500,'邵阳市',430000 unionselect 191,430600,'岳阳市',430000 unionselect 192,430700,'常德市',430000 unionselect 193,430800,'张家界市',430000 unionselect 194,430900,'益阳市',430000 unionselect 195,431000,'郴州市',430000 unionselect 196,431100,'永州市',430000 unionselect 197,431200,'怀化市',430000 unionselect 198,431300,'娄底市',430000 unionselect 199,433100,'湘西土家族苗族自治州',430000 union select 200,440100,'广州市',440000 unionselect 201,440200,'韶关市',440000 unionselect 202,440300,'深圳市',440000 unionselect 203,440400,'珠海市',440000 unionselect 204,440500,'汕头市',440000 unionselect 205,440600,'佛山市',440000 unionselect 206,440700,'江门市',440000 unionselect 207,440800,'湛江市',440000 unionselect 208,440900,'茂名市',440000 unionselect 209,441200,'肇庆市',440000 unionselect 210,441300,'惠州市',440000 unionselect 211,441400,'梅州市',440000 unionselect 212,441500,'汕尾市',440000 unionselect 213,441600,'河源市',440000 unionselect 214,441700,'阳江市',440000 unionselect 215,441800,'清远市',440000 unionselect 216,441900,'东莞市',440000 unionselect 217,442000,'中山市',440000 unionselect 218,445100,'潮州市',440000 unionselect 219,445200,'揭阳市',440000 unionselect 220,445300,'云浮市',440000 unionselect 221,450100,'南宁市',450000 unionselect 222,450200,'柳州市',450000 unionselect 224,450400,'梧州市',450000 unionselect 225,450500,'北海市',450000INSERT city(id,cityID,city,fatherID)select 226,450600,'防城港市',450000 unionselect 227,450700,'钦州市',450000 unionselect 228,450800,'贵港市',450000 unionselect 229,450900,'玉林市',450000 unionselect 230,451000,'百色市',450000 unionselect 231,451100,'贺州市',450000 unionselect 232,451200,'河池市',450000 unionselect 233,451300,'来宾市',450000 unionselect 234,451400,'崇左市',450000 unionselect 235,460100,'海口市',460000 unionselect 236,460200,'三亚市',460000 unionselect 237,469000,'省直辖县级行政单位',460000 union select 238,500100,'市辖区',500000 unionselect 239,500200,'县',500000 unionselect 240,500300,'市',500000 unionselect 241,510100,'成都市',510000 unionselect 242,510300,'自贡市',510000 unionselect 243,510400,'攀枝花市',510000 unionselect 244,510500,'泸州市',510000 unionselect 245,510600,'德阳市',510000 unionselect 246,510700,'绵阳市',510000 unionselect 247,510800,'广元市',510000 unionselect 248,510900,'遂宁市',510000 unionselect 249,511000,'内江市',510000 unionselect 250,511100,'乐山市',510000 unionselect 251,511300,'南充市',510000 unionselect 252,511400,'眉山市',510000 unionselect 253,511500,'宜宾市',510000 unionselect 254,511600,'广安市',510000 unionselect 255,511700,'达州市',510000 unionselect 256,511800,'雅安市',510000 unionselect 257,511900,'巴中市',510000 unionselect 258,512000,'资阳市',510000 unionselect 259,513200,'阿坝藏族羌族自治州',510000 union select 260,513300,'甘孜藏族自治州',510000 union select 261,513400,'凉山彝族自治州',510000 union select 262,520100,'贵阳市',520000 unionselect 263,520200,'六盘水市',520000INSERT city(id,cityID,city,fatherID)select 264,520300,'遵义市',520000 unionselect 265,520400,'安顺市',520000 unionselect 266,522200,'铜仁地区',520000 unionselect 267,522300,'黔西南布依族苗族自治州',520000 union select 268,522400,'毕节地区',520000 unionselect 269,522600,'黔东南苗族侗族自治州',520000 union select 270,522700,'黔南布依族苗族自治州',520000 union select 271,530100,'昆明市',530000 unionselect 272,530300,'曲靖市',530000 unionselect 273,530400,'玉溪市',530000 unionselect 274,530500,'保山市',530000 unionselect 275,530600,'昭通市',530000 unionselect 276,530700,'丽江市',530000 unionselect 277,530800,'思茅市',530000 unionselect 278,530900,'临沧市',530000 unionselect 279,532300,'楚雄彝族自治州',530000 unionselect 280,532500,'红河哈尼族彝族自治州',530000 union select 281,532600,'文山壮族苗族自治州',530000 union select 282,532800,'西双版纳傣族自治州',530000 union select 283,532900,'大理白族自治州',530000 unionselect 284,533100,'德宏傣族景颇族自治州',530000 union select 285,533300,'怒江傈僳族自治州',530000 union select 286,533400,'迪庆藏族自治州',530000 unionselect 287,540100,'拉萨市',540000 unionselect 288,542100,'昌都地区',540000 unionselect 289,542200,'山南地区',540000 unionselect 290,542300,'日喀则地区',540000 unionselect 291,542400,'那曲地区',540000 unionselect 292,542500,'阿里地区',540000 unionselect 293,542600,'林芝地区',540000INSERT city(id,cityID,city,fatherID)select 294,610100,'西安市',610000 unionselect 295,610200,'铜川市',610000 unionselect 296,610300,'宝鸡市',610000 unionselect 297,610400,'咸阳市',610000 unionselect 298,610500,'渭南市',610000 unionselect 299,610600,'延安市',610000 unionselect 300,610700,'汉中市',610000 unionselect 301,610800,'榆林市',610000 unionselect 302,610900,'安康市',610000 unionselect 303,611000,'商洛市',610000 unionselect 304,620100,'兰州市',620000 unionselect 305,620200,'嘉峪关市',620000 unionselect 306,620300,'金昌市',620000 unionselect 307,620400,'白银市',620000 unionselect 308,620500,'天水市',620000 unionselect 309,620600,'武威市',620000 unionselect 310,620700,'张掖市',620000 unionselect 311,620800,'平凉市',620000 unionselect 312,620900,'酒泉市',620000 unionselect 313,621000,'庆阳市',620000 unionselect 314,621100,'定西市',620000 unionselect 315,621200,'陇南市',620000 unionselect 316,622900,'临夏回族自治州',620000 unionselect 317,623000,'甘南藏族自治州',620000 unionselect 318,630100,'西宁市',630000 unionselect 319,632100,'海东地区',630000 unionselect 320,632200,'海北藏族自治州',630000 unionselect 321,632300,'黄南藏族自治州',630000 unionselect 322,632500,'海南藏族自治州',630000 unionselect 323,632600,'果洛藏族自治州',630000 unionselect 324,632700,'玉树藏族自治州',630000INSERT city(id,cityID,city,fatherID)select 325,632800,'海西蒙古族藏族自治州',630000 union select 326,640100,'银川市',640000 unionselect 327,640200,'石嘴山市',640000 unionselect 328,640300,'吴忠市',640000 unionselect 329,640400,'固原市',640000 unionselect 330,640500,'中卫市',640000 unionselect 331,650100,'乌鲁木齐市',650000 unionselect 332,650200,'克拉玛依市',650000 unionselect 333,652100,'吐鲁番地区',650000 unionselect 334,652200,'哈密地区',650000 unionselect 335,652300,'昌吉回族自治州',650000 unionselect 336,652700,'博尔塔拉蒙古自治州',650000 union select 337,652800,'巴音郭楞蒙古自治州',650000 union select 338,652900,'阿克苏地区',650000INSERT city(id,cityID,city,fatherID)select 339,653000,'克孜勒苏柯尔克孜自治州',650000 union select 340,653100,'喀什地区',650000 unionselect 341,653200,'和田地区',650000 unionselect 342,654000,'伊犁哈萨克自治州',650000 union select 343,654200,'塔城地区',650000 unionselect 344,654300,'阿勒泰地区',650000 union select 345,659000,'省直辖行政单位',650000INSERT INTO area(id,areaID,area,fatherID)select 1,110101,'东城区',110100 unionselect 2,110102,'西城区',110100 unionselect 3,110103,'崇文区',110100 unionselect 4,110104,'宣武区',110100 unionselect 5,110105,'朝阳区',110100 unionselect 6,110106,'丰台区',110100 unionselect 7,110107,'石景山区',110100 unionselect 8,110108,'海淀区',110100 unionselect 9,110109,'门头沟区',110100 unionselect 10,110111,'房山区',110100 unionselect 11,110112,'通州区',110100 unionselect 12,110113,'顺义区',110100 unionselect 13,110114,'昌平区',110100 unionselect 14,110115,'大兴区',110100 unionselect 15,110116,'怀柔区',110100 unionselect 16,110117,'平谷区',110100 unionselect 17,110228,'密云县',110200 unionselect 18,110229,'延庆县',110200 unionselect 19,120101,'和平区',120100 unionselect 20,120102,'河东区',120100 unionselect 21,120103,'河西区',120100 unionselect 22,120104,'南开区',120100 unionselect 23,120105,'河北区',120100 unionselect 24,120106,'红桥区',120100 unionselect 25,120107,'塘沽区',120100 unionselect 26,120108,'汉沽区',120100 unionselect 27,120109,'大港区',120100 unionselect 28,120110,'东丽区',120100 unionselect 29,120111,'西青区',120100 unionselect 30,120112,'津南区',120100 unionselect 31,120113,'北辰区',120100 unionselect 32,120114,'武清区',120100 unionselect 33,120115,'宝坻区',120100 unionselect 34,120221,'宁河县',120200 unionselect 35,120223,'静海县',120200 unionselect 36,120225,'蓟县',120200 unionselect 37,130101,'市辖区',130100 unionselect 39,130103,'桥东区',130100 unionselect 40,130104,'桥西区',130100 unionselect 41,130105,'新华区',130100 unionselect 42,130107,'井陉矿区',130100 union select 43,130108,'裕华区',130100 unionselect 44,130121,'井陉县',130100 unionselect 45,130123,'正定县',130100 unionselect 46,130124,'栾城县',130100 unionselect 47,130125,'行唐县',130100 unionselect 48,130126,'灵寿县',130100 unionselect 49,130127,'高邑县',130100 unionselect 50,130128,'深泽县',130100 unionselect 51,130129,'赞皇县',130100 unionselect 52,130130,'无极县',130100 unionselect 53,130131,'平山县',130100 unionselect 54,130132,'元氏县',130100 unionselect 55,130133,'赵县',130100 unionselect 56,130181,'辛集市',130100 unionselect 57,130182,'藁城市',130100 unionselect 58,130183,'晋州市',130100 unionselect 59,130184,'新乐市',130100 unionselect 60,130185,'鹿泉市',130100 unionselect 61,130201,'市辖区',130200 unionselect 62,130202,'路南区',130200 unionselect 63,130203,'路北区',130200 unionselect 64,130204,'古冶区',130200 unionselect 65,130205,'开平区',130200 unionselect 66,130207,'丰南区',130200 unionselect 67,130208,'丰润区',130200 unionselect 68,130223,'滦县',130200 unionselect 69,130224,'滦南县',130200 unionselect 70,130225,'乐亭县',130200 unionselect 71,130227,'迁西县',130200 unionselect 72,130229,'玉田县',130200 unionselect 73,130230,'唐海县',130200 unionselect 74,130281,'遵化市',130200 unionselect 75,130283,'迁安市',130200 unionselect 76,130301,'市辖区',130300 unionselect 77,130302,'海港区',130300 unionselect 78,130303,'山海关区',130300 union select 79,130304,'北戴河区',130300 union select 80,130321,'青龙满族自治县',130300 union select 81,130322,'昌黎县',130300 unionselect 83,130324,'卢龙县',130300 union select 84,130401,'市辖区',130400 union select 85,130402,'邯山区',130400 union select 86,130403,'丛台区',130400 union select 87,130404,'复兴区',130400 union select 88,130406,'峰峰矿区',130400 union select 89,130421,'邯郸县',130400 union select 90,130423,'临漳县',130400 union select 91,130424,'成安县',130400 union select 92,130425,'大名县',130400 union select 93,130426,'涉县',130400 union select 94,130427,'磁县',130400 union select 95,130428,'肥乡县',130400 union select 96,130429,'永年县',130400 union select 97,130430,'邱县',130400 union select 98,130431,'鸡泽县',130400 union select 99,130432,'广平县',130400 union select 100,130433,'馆陶县',130400 union select 101,130434,'魏县',130400 union select 102,130435,'曲周县',130400 union select 103,130481,'武安市',130400 union select 104,130501,'市辖区',130500 union select 105,130502,'桥东区',130500 union select 106,130503,'桥西区',130500 union select 107,130521,'邢台县',130500 union select 108,130522,'临城县',130500 union select 109,130523,'内丘县',130500 union select 110,130524,'柏乡县',130500 union select 111,130525,'隆尧县',130500 union select 112,130526,'任县',130500 union select 113,130527,'南和县',130500 union select 114,130528,'宁晋县',130500 union select 115,130529,'巨鹿县',130500 union select 116,130530,'新河县',130500 union select 117,130531,'广宗县',130500 union select 118,130532,'平乡县',130500 union select 119,130533,'威县',130500 union select 120,130534,'清河县',130500 union select 121,130535,'临西县',130500 union select 122,130581,'南宫市',130500 union select 123,130582,'沙河市',130500 union select 124,130601,'市辖区',130600 union select 125,130602,'新市区',130600 unionselect 127,130604,'南市区',130600 union select 128,130621,'满城县',130600 union select 129,130622,'清苑县',130600 union select 130,130623,'涞水县',130600 union select 131,130624,'阜平县',130600 union select 132,130625,'徐水县',130600 union select 133,130626,'定兴县',130600 union select 134,130627,'唐县',130600 union select 135,130628,'高阳县',130600 union select 136,130629,'容城县',130600 union select 137,130630,'涞源县',130600 union select 138,130631,'望都县',130600 union select 139,130632,'安新县',130600 union select 140,130633,'易县',130600 union select 141,130634,'曲阳县',130600 union select 142,130635,'蠡县',130600 union select 143,130636,'顺平县',130600 union select 144,130637,'博野县',130600 union select 145,130638,'雄县',130600 union select 146,130681,'涿州市',130600 union select 147,130682,'定州市',130600 union select 148,130683,'安国市',130600 union select 149,130684,'高碑店市',130600 union select 150,130701,'市辖区',130700 union select 151,130702,'桥东区',130700 union select 152,130703,'桥西区',130700 union select 153,130705,'宣化区',130700 union select 154,130706,'下花园区',130700 union select 155,130721,'宣化县',130700 union select 156,130722,'张北县',130700 union select 157,130723,'康保县',130700 union select 158,130724,'沽源县',130700 union select 159,130725,'尚义县',130700 union select 160,130726,'蔚县',130700 union select 161,130727,'阳原县',130700 union select 162,130728,'怀安县',130700 union select 163,130729,'万全县',130700 union select 164,130730,'怀来县',130700 union select 165,130731,'涿鹿县',130700 union select 166,130732,'赤城县',130700 union select 167,130733,'崇礼县',130700 union select 168,130801,'市辖区',130800 union select 169,130802,'双桥区',130800 unionselect 171,130804,'鹰手营子矿区',130800 unionselect 172,130821,'承德县',130800 unionselect 173,130822,'兴隆县',130800 unionselect 174,130823,'平泉县',130800 unionselect 175,130824,'滦平县',130800 unionselect 176,130825,'隆化县',130800 unionselect 177,130826,'丰宁满族自治县',130800 union select 178,130827,'宽城满族自治县',130800 union select 179,130828,'围场满族蒙古族自治县',130800 union select 180,130901,'市辖区',130900 unionselect 181,130902,'新华区',130900 unionselect 182,130903,'运河区',130900 unionselect 183,130921,'沧县',130900 unionselect 184,130922,'青县',130900 unionselect 185,130923,'东光县',130900 unionselect 186,130924,'海兴县',130900 unionselect 187,130925,'盐山县',130900 unionselect 188,130926,'肃宁县',130900 unionselect 189,130927,'南皮县',130900 unionselect 190,130928,'吴桥县',130900 unionselect 191,130929,'献县',130900 unionselect 192,130930,'孟村回族自治县',130900 union select 193,130981,'泊头市',130900 unionselect 194,130982,'任丘市',130900 unionselect 195,130983,'黄骅市',130900 unionselect 196,130984,'河间市',130900 unionselect 197,131001,'市辖区',131000 unionselect 198,131002,'安次区',131000 unionselect 199,131003,'广阳区',131000 unionselect 200,131022,'固安县',131000 unionselect 201,131023,'永清县',131000 unionselect 202,131024,'香河县',131000 unionselect 203,131025,'大城县',131000 unionselect 204,131026,'文安县',131000 unionselect 205,131028,'大厂回族自治县',131000 union select 206,131081,'霸州市',131000 unionselect 207,131082,'三河市',131000 unionselect 208,131101,'市辖区',131100 unionselect 209,131102,'桃城区',131100 unionselect 210,131121,'枣强县',131100 unionselect 211,131122,'武邑县',131100 unionselect 212,131123,'武强县',131100 unionselect 213,131124,'饶阳县',131100 unionselect 215,131126,'故城县',131100 union select 216,131127,'景县',131100 union select 217,131128,'阜城县',131100 union select 218,131181,'冀州市',131100 union select 219,131182,'深州市',131100 union select 220,140101,'市辖区',140100 union select 221,140105,'小店区',140100 union select 222,140106,'迎泽区',140100 union select 223,140107,'杏花岭区',140100 union select 224,140108,'尖草坪区',140100 union select 225,140109,'万柏林区',140100 union select 226,140110,'晋源区',140100 union select 227,140121,'清徐县',140100 union select 228,140122,'阳曲县',140100 union select 229,140123,'娄烦县',140100 union select 230,140181,'古交市',140100 union select 231,140201,'市辖区',140200 union select 232,140202,'城区',140200 union select 233,140203,'矿区',140200 union select 234,140211,'南郊区',140200 union select 235,140212,'新荣区',140200 union select 236,140221,'阳高县',140200 union select 237,140222,'天镇县',140200 union select 238,140223,'广灵县',140200 union select 239,140224,'灵丘县',140200 union select 240,140225,'浑源县',140200 union select 241,140226,'左云县',140200 union select 242,140227,'大同县',140200 union select 243,140301,'市辖区',140300 union select 244,140302,'城区',140300 union select 245,140303,'矿区',140300 union select 246,140311,'郊区',140300 union select 247,140321,'平定县',140300 union select 248,140322,'盂县',140300 union select 249,140401,'市辖区',140400 union select 250,140402,'城区',140400 union select 251,140411,'郊区',140400 union select 252,140421,'长治县',140400 union select 253,140423,'襄垣县',140400 union select 254,140424,'屯留县',140400 union select 255,140425,'平顺县',140400 union select 256,140426,'黎城县',140400 union select 257,140427,'壶关县',140400 union。
mysql根据村行政编号查询地区id组,村行政编号查询整串地区名称
mysql根据村⾏政编号查询地区id组,村⾏政编号查询整串地区名称地区表⾥⾯是有6级的,级别分别是:国、省/直辖市、市、区/县、乡镇、村/⼩区,实现通过村的地区⾏政编号查询整个详细地址。
数据库中准备好地区数据,表名称为“area1”,字段结构如下:字段结构中,id是地区的id号,parent_id是地区与上级地区的关联id,如此有序构建6级地区,从国⼀直构建到村。
数据表⾥⾯的数据截图如下:我们要实现通过输⼊村的number(地区编号)就能查询出村上⾯的⼀串的详细地址,并且能查询出⼀串的ID组由于下级与上级的关系是⽤parent_id字段做关联的,地址数据不在⼀条上⾯,每次查询编号时,都要对应的查询上层5次,所以sql语句较为⿇烦。
sql语句如下:SELECT`a6`.`number` AS `number`,concat(`a1`.`id`,',',`a2`.`id`,',',`a3`.`id`,',',`a4`.`id`,',',`a5`.`id`,',',`a6`.`id`) AS `area_id`,concat( `a1`.`name`, `a2`.`name`, `a3`.`name`, `a4`.`name`, `a5`.`name`, `a6`.`name` ) AS `area_name`FROM(((((`area1` `a6`JOIN `area1` `a5` ON ((`a6`.`parent_id` = `a5`.`id`)))JOIN `area1` `a4` ON ((`a5`.`parent_id` = `a4`.`id`)))JOIN `area1` `a3` ON ((`a4`.`parent_id` = `a3`.`id`)))JOIN `area1` `a2` ON ((`a3`.`parent_id` = `a2`.`id`)))JOIN `area1` `a1` ON ((`a2`.`parent_id` = `a1`.`id`)))WHERE((`a6`.`level` =6)AND ( `a6`.`number` =110101001002 ))LIMIT 0,1通过以上sql语句,只要改变number的值就能得到结果,查询结果如下图:这样就实现了通过number(地区⾏政编号)查询area_id(id组),area_name(详细地址)的作⽤。
sql 的编码格式-概述说明以及解释
sql 的编码格式-概述说明以及解释1.引言1.1 概述SQL(结构化查询语言)是用于管理和操作关系型数据库的编程语言。
在进行SQL编码时,正确的编码格式对于保证数据的完整性、准确性和安全性至关重要。
本文将详细介绍SQL编码格式的定义、常见的SQL编码格式以及SQL编码格式的重要性。
在编写SQL语句时,需要按照一定的格式和规范来编码,以保证语句的可读性和易维护性。
SQL编码格式主要包括缩进、换行、大小写、注释等方面的规范。
首先,缩进在SQL编码中起到了对语句进行层级划分的作用,使得代码结构清晰可见。
通过缩进,可以清晰地区分出SELECT语句、FROM子句、WHERE子句等不同的部分。
其次,换行在SQL编码中能够使得复杂的SQL语句更易理解。
将不同的子句和关键字放在不同的行上,可以使得语句的层次更加明确,也便于注释和修改。
同时,对于SQL关键字和标识符的大小写,也需要遵循一定的编码规范。
一般来说,SQL关键字建议使用大写,而表名、列名等标识符则建议使用小写。
这样可以增加代码的可读性,并且能够避免与关键字冲突的问题。
此外,在SQL编码时添加注释是十分重要的。
注释能够增加代码的可维护性和可读性,帮助其他人更好地理解意图和功能。
注释可以在语句的前面或是行内进行添加,以帮助开发人员更好地理解该段代码的作用和目的。
综上所述,SQL编码格式在数据库开发中起到了至关重要的作用。
通过正确的缩进、换行、大小写和注释等编码格式,可以使得SQL语句更加易读、易懂,提高代码的可维护性和可读性。
在后续的章节中,本文将进一步讨论常见的SQL编码格式以及SQL编码格式的重要性。
1.2 文章结构本文主要以SQL 的编码格式为主题进行探讨和研究。
为了更好地阐述SQL 编码格式的定义、常见的格式以及其重要性,本文将从以下几个方面进行分析。
首先,将介绍SQL 编码格式的定义。
我们将解释什么是SQL 编码格式,它是一种用于编写SQL 语句的规范和约定。
mysql查询表结构的sql语句
mysql查询表结构的sql语句正文:要查询MySQL数据库中表的结构,可以使用DESCRIBE语句或SHOW COLUMNS语句。
这些语句可以向用户提供有关表的详细信息,如列名、数据类型、键信息等。
1. DESCRIBE语句:使用DESCRIBE语句可以获取表的结构信息。
语法如下:DESCRIBE table_name;例如,如果想要查询名为'customers'的表的结构,可以执行以下语句:DESCRIBE customers;这将返回一个包含列名、数据类型、键信息等的结果集。
2. SHOW COLUMNS语句:SHOW COLUMNS语句也可以用于查询表的结构信息。
语法如下:SHOW COLUMNS FROM table_name;例如,如果要查询名为'orders'的表的结构,可以执行以下语句:SHOW COLUMNS FROM orders;这将返回一个包含列名、数据类型、键信息等的结果集。
以上两种方法都可以用来查询表的结构信息,具体选择哪种方法取决于个人偏好和需求。
DESCRIBE语句通常更简洁,而SHOW COLUMNS语句提供了更多的选项来自定义查询结果。
另外,如果想要查看整个数据库中所有表的结构,可以使用SHOW TABLES语句获取所有表名,然后逐个执行DESCRIBE或SHOW COLUMNS 语句来获取每个表的结构信息。
综上所述,通过使用DESCRIBE或SHOW COLUMNS语句,您可以轻松地查询MySQL数据库中表的结构信息。
这对于了解表的列、数据类型和键信息等非常有用,以便进行进一步的数据分析和查询优化。
数据库SQL管理和编码
数据库管理引语:数据库管理(Database Manager)是有关建立、存储、修改和存取数据库中信息的技术,是指为保证数据库系统的正常运行和服务质量,有关人员须进行的技术管理工作。
负责这些技术管理工作的个人或集体称为数据库管理员(DBA)。
数据库管理的主要内容有:数据库的调优、数据库的重组、数据库的重构、数据库的安全管控、报错问题的分析和汇总和处理、数据库数据的日常备份. 数据库的建立:数据库的设计只是提供了数据的类型、逻辑结构、联系、约束和存储结构等有关数据的描述。
这些描述称为数据模式正文:数据库管理包括数据库规划、设计、实施、运行和维护五个阶段一、数据库规划:构建用来描述学生的数据表,要求记录学生的如下属性:姓名、学号、性别、生源地、状态、考试成绩、学分、选课二、数据库设计:create schema studentcreate table student.学生(学号 char(8) primary key,院系 as convert(tinyint,substring(学号,3,2)) persisted not nullforeign key references student.院系(编号),姓名 char(10) not null,性别 char(2) check(性别='男' or 性别='女'),生源 char(6),状态 char(4) check(状态 in ('正常','留级','休学','退学')))insert into student.学生values('04014101','曹波','男','湖北','正常')insert into student.学生values('04014111','程鸣','女','湖南','正常')insert into student.学生values('04014122','吴红霞','女','浙江','正常')insert into student.学生values('04026205','张鸿飞','男','北京','正常')insert into student.学生values('04026210','张雪梅','女','贵州','休学')insert into student.学生values('04016108','林报国','男','上海','正常')insert into student.学生values('04016116','王丽','女','北京','正常')insert into student.学生values('05113102','郝海涛','男','河南','正常')insert into student.学生values('05113110','王伟','男','北京','正常')select 学生.学号,姓名,课程名称,考试成绩from student.学生 join student.选课 on 学生.学号=选课.学号join student.课程 on 选课.课程编号=课程.课程编号where 考试成绩>=90select 学生.学号,姓名,课程名称,考试成绩from student.学生 cross join student.选课 cross join student.课程where 学生.学号=选课.学号and 选课.课程编号=课程.课程编号 and 考试成绩>=90select 学生.学号,姓名,课程名称,考试成绩from student.课程 join student.选课on 选课.课程编号=课程.课程编号join student.学生 on 学生.学号=选课.学号order by 学生.学号compute avg(考试成绩),max(考试成绩),min(考试成绩) by 学生.学号select 学生.学号,姓名,课程名称,考试成绩from student.课程 join student.选课on 选课.课程编号=课程.课程编号join student.学生 on 学生.学号=选课.学号order by 学生.学号compute avg(考试成绩),max(考试成绩),min(考试成绩) by 学生.学号compute avg(考试成绩),max(考试成绩),min(考试成绩)三、数据库实施成果:四、数据库安全配置1.使用安全的密码策略我们把密码策略摆在所有安全配置的第一步,请注意,很多数据库账号的密码过于简单,这跟系统密码过于简单是一个道理。
小区表sql结构
小区表sql结构
本文介绍小区表的sql结构设计。
小区表是指记录不同小区的基本信息,如小区名称、地址、建筑年代等。
其主要作用是为房屋出租、买卖等业务提供基础数据支持。
在设计小区表时,通常包括以下字段:
1. 小区编号(community_id):用于唯一标识不同的小区,通常是自增长整数。
2. 小区名称(community_name):小区的名称,长度一般不超过50个字符。
3. 小区地址(community_address):小区的详细地址,长度一般不超过100个字符。
4. 建筑年代(build_year):小区的建筑年代,通常为4位数字年份。
5. 占地面积(land_area):小区的占地面积,通常为浮点数类型。
6. 建筑面积(build_area):小区的建筑面积,通常为浮点数类型。
7. 房屋数量(house_num):小区中的房屋数量,通常为整数类型。
8. 物业费用(property_fee):小区的物业费用,通常为浮点数类型。
9. 开发商(developer):小区的开发商,长度一般不超过50个
字符。
10. 物业公司(property_company):小区的物业公司名称,长度一般不超过50个字符。
以上是小区表常用字段,根据实际业务需求可进行增删调整。
设计好小区表的sql结构,可以为后续业务的开展提供便利。
sql的基本结构
sql的基本结构SQL是Structured Query Language的缩写,是一种用于管理和操作关系型数据库的语言。
SQL的基本结构包括以下几个部分:1. 数据库的创建和删除在SQL中,可以使用CREATE DATABASE语句来创建一个新的数据库,语法如下:CREATE DATABASE database_name;其中,database_name是要创建的数据库的名称。
如果要删除一个数据库,可以使用DROP DATABASE语句,语法如下:DROP DATABASE database_name;2. 表的创建和删除在SQL中,可以使用CREATE TABLE语句来创建一个新的表,语法如下:CREATE TABLE table_name (column1 datatype,column2 datatype,column3 datatype,.....);其中,table_name是要创建的表的名称,column1、column2、column3等是表中的列名,datatype是列的数据类型。
如果要删除一个表,可以使用DROP TABLE语句,语法如下:DROP TABLE table_name;3. 数据的插入、更新和删除在SQL中,可以使用INSERT INTO语句来向表中插入新的数据,语法如下:INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);其中,table_name是要插入数据的表的名称,column1、column2、column3等是表中的列名,value1、value2、value3等是要插入的数据。
如果要更新表中的数据,可以使用UPDATE语句,语法如下:UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;其中,table_name是要更新数据的表的名称,column1、column2等是要更新的列名,value1、value2等是要更新的数据,condition是更新数据的条件。
利用SQL语句实现宗地快速编号
利用SQL语句实现宗地快速编号王志平【摘要】在新的《地籍调查规程》对宗地的统一编号要求下,城镇地籍数据库升级、集体所有权调查、村庄地籍调查等工作,都存在大量宗地的统一编号需求.本文将宗地的空间排序及编号用SQL操作方式来实现,提高了编号效率.【期刊名称】《北京测绘》【年(卷),期】2016(000)002【总页数】3页(P133-134,142)【关键词】宗地;快速编号;SQL【作者】王志平【作者单位】上海瑞纳信息技术有限公司,上海200433【正文语种】中文【中图分类】P2081 前言为推进以土地为基础的不动产统一登记工作,推动城乡一体化地籍管理进程,逐步实现国土资源信息化、标准化,国土资源部印发了《全国宗地统一代码编制工作实施方案》的通知(国土资发〔2012〕4号)。
不仅最近几年开展的集体土地所有权调查、村庄地籍调查要求以新的编码规则进行宗地编号,老的城镇地籍系统升级时,所有宗地也要按照新规则进行统一编号。
面对数量巨大的宗地和界址点,如何快速高效的进行重新编号是一个值得研究的问题。
2 宗地统一编号原则全国宗地统一编码采用“地籍区和地籍子区”两个级别的编码分区概念,遵循宗地统一编码的原则。
地籍区、地籍子区的划分有三种模式:一是按照现行乡镇、街道划分;二是以现行乡镇街道为基础,结合典型线状地物划分;三是完成按照典型线状地物划分。
《地籍调查规程》要求[1],在地籍子区范围内,从西到东,从北到南,统一预编宗地号。
宗地代码采用五层19位层次码结构,按层次分别表示县级行政区划、地籍区、地籍子区、土地所有权类型、宗地号。
第一层次为县级行政区划,代码为6位,采用《中华人民共和国行政区划代码》(GB/T 2260)。
第二层次为地籍区,代码为3位,用01~999表示。
第三层次为地籍子区,代码为3位,用01~999表示。
第四层次为土地权属类型,代码为2位,其中第一位表示土地所有权类型,用G、J、Z表示,第二位表示宗地特征码,用 A、B、S、X、C、W、Y表示。