Git Product home page Git Product logo

tang_poetry's Introduction

全唐诗数据库

去井盖讨论

爬取的全唐诗数据库

使用

  1. 新建数据库
mysql> create database tang_poetry;
mysql> exit;
  1. 导入数据
mysql -u root -p -h localhost tang_poetry < tang_poetry.sql

内容

有两张表,一张作者,一张古诗

%load_ext sql
%sql mysql+pymysql://root:12345678@127.0.0.1/tang_poetry
'Connected: root@tang_poetry'
%sql SHOW tables;
 * mysql+pymysql://root:***@127.0.0.1/tang_poetry
2 rows affected.
Tables_in_tang_poetry
poetries
poets
%sql DESCRIBE poetries
 * mysql+pymysql://root:***@127.0.0.1/tang_poetry
6 rows affected.
Field Type Null Key Default Extra
id int(11) NO PRI None auto_increment
poet_id int(11) YES None
content text YES None
title varchar(255) YES None
created_at datetime YES None
updated_at datetime YES None
%sql DESCRIBE poets
 * mysql+pymysql://root:***@127.0.0.1/tang_poetry
4 rows affected.
Field Type Null Key Default Extra
id int(11) NO PRI None auto_increment
name varchar(255) YES None
created_at datetime YES None
updated_at datetime YES None

例子

查看唐朝写诗歌最多的人

%%sql

SELECT
    poets.name,
    COUNT(poetries.id) AS poetries_count
FROM
    poetries
LEFT JOIN poets ON poets.id = poetries.poet_id
GROUP BY
    poets.id
ORDER BY
    poetries_count
DESC
LIMIT 10
 * mysql+pymysql://root:***@127.0.0.1/tang_poetry
10 rows affected.
name poetries_count
白居易 2643
杜甫 1158
李白 896
佚名 841
齐己 783
刘禹锡 703
元稹 593
李商隐 555
贯休 553
韦应物 551

全唐诗库的总数量

%%sql 

SELECT
    COUNT(*)
FROM
    poetries
 * mysql+pymysql://root:***@127.0.0.1/tang_poetry
1 rows affected.
COUNT(*)
43030
%%sql

SELECT
    poets.name,
    poetries.title,
    poetries.content
FROM
    poetries
LEFT JOIN poets ON poets.id = poetries.poet_id
WHERE
    poets.name = '杨玉环'
 * mysql+pymysql://root:***@127.0.0.1/tang_poetry
1 rows affected.
name title content
杨玉环 赠张云容舞 罗袖动香香不已,红蕖袅袅秋烟里。轻云岭上乍摇风,嫩柳池边初拂水。

tang_poetry's People

Contributors

hxgdzyuyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tang_poetry's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.