<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
import sqlite3
!wget https://github.com/bofori-tech/DS-Unit-3-Sprint-2-SQL-and-Databases/blob/master/module1-introduction-to-sql/rpg_db.sqlite3?raw=true
conn = sqlite3.connect('rpg_db.sqlite3?raw=true')
cur = conn.cursor()
query = """
SELECT * 
FROM armory_item"""
cur.execute(query)
result_list = cur.fetchall()
cols = [ii[0] for ii in cur.description]
cols
pd.DataFrame(result_list, columns=cols)
df=pd.read_sql(query, conn, index_col= 'item_id')
df.head()
query = """
SELECT ai.item_id, ai.name, ai.value, ai.weight
FROM armory_item ai 
JOIN charactercreator_character cc
ON ai.item_id = cc.character_id
"""

df = pd.read_sql(query, conn)
df
query = """
SELECT COUNT(character_id) 
FROM charactercreator_character"""
cur.execute(query)
result_list = cur.fetchall()
result_list
query = """
SELECT SUM(Quantity)
FROM OrderDetails"""
result_list = cur.fetchall()
result_list<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14167528438469493, 'fraction_numerical': 0.008273009307135471, 'mean_word_length': 6.3893129770992365, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '279233', 'license': 'MIT', 'n_tokens_mistral': 369, 'n_tokens_neox': 361, 'n_words': 69, 'path': 'rpg_queries_py.ipynb', 'repo_name': 'bofori-tech/DS-Unit-3-Sprint-2-SQL-and-Databases', 'size': '967'}