- 博客(9)
- 收藏
- 关注
原创 pymysql模块:通过python操作MySQL
我们使用python爬取得到的数据,有时候会数据量特别大,需要存入数据库。需要注意的是,MySQL是一种关系型数据库管理系统,利用MySQL可以对数据库进行操作,而MySQL并不是一个数据库。而pymysql库的作用就是在python中对MySQL进行操作。 简单来说,使用pymysql库对MySQL进行操作,分为以下三个步骤:1. 同MySQL建立连接要对MySQL进行操...
2018-12-19 17:33:49
466
转载 [转]json模块使用说明
目录1. 概述2. 读取JSON2.1 最简单的例子2.2 bytes和bytearray数据2.3 编码格式2.4 数据类型转换2.5 自定义JSON对象转换类型2.6 自定义JSON数字转换类型2.7 非对象顶级值2.8 重复键名2.9 处理JSON数据文件3 生成JSON3.1 编码格式3.2 数据类型转换3.3 循环引用3.4...
2018-12-19 16:21:42
776
原创 python内建库-urllib
介绍urllib是Python自带的标准库,无需安装,直接可以用。提供了如下功能:网页请求响应获取代理和cookie设置异常处理URL解析爬虫所需要的功能,基本上在urllib中都能找到,学习这个标准库,可以更加深入的理解后面更加便利的requests库。urllib,urllib2,request之间的关系在Python2中,分为urllib库和urllib2库,...
2018-12-08 22:08:56
884
原创 SQL-Query on Multiple Tables
Write a query to find those customers with their name and those salesmen with their name and city who lives in the same city.SELECT customer.cust_name, salesman.name, customer.cityFROM customerJOIN...
2018-12-07 00:55:46
354
原创 SQL-Formatting Output
Write a SQL statement to display the commission with the percent sign ( % ) with salesman ID, name and city columns for all the salesmen.疑问:题目的意思应该是,输出数据时将commission的值转化为百分比值网站给出的标准答案并没有实现此功能---...
2018-12-06 23:55:24
460
原创 SQL-Aggregate Functions
Write a SQL statement to find the total purchase amount of all orders.SELECT SUM(purch_amt)FROM orders;Write a SQL statement to find the average purchase amount of all orders.SELECT AVG(purch_amt...
2018-12-06 21:08:30
649
原创 SQL-Wildcard and Special operators
下划线_: 通配符/占位符,匹配单个字符ESCAPE:需要查询特殊字符时,使用ESCAPE进行转义语法:WHERE ColumnA LIKE ‘%5/%%’ ESCAPE ‘/’Write a SQL statement to find those salesmen with all information who come from the city either...
2018-12-06 17:07:12
408
原创 SQL-Boolean and Relational Operators
Write a query to display all customers with a grade above 100.SELECT * FROM customer WHERE grade>100;Write a query statement to display all customers in New York who have a grade value above 100...
2018-12-06 16:08:29
290
原创 SQL-retrieve data from tables
Retrieve data from tablesWrite a SQL statement to display all the information of all salesmen.SELECT * FROM salesman;Write a SQL statement to display a string “This is SQL Exercise, Practice and S...
2018-12-06 14:57:50
7799
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人