<jupyter_start><jupyter_text>Relational DatabaseCreated by: <NAME>  Create a connection<jupyter_code>import sqlite3
# load sqlite3 library
import sqlite3

# create a connection to database
connection = sqlite3.connect('my_database.sqlite')

# create an interface to the database 
# that allows running anySQL query on our database.
cursor = connection.cursor()<jupyter_output><empty_output><jupyter_text>Creating new table<jupyter_code># creating a table named 'SCHOOL'
cursor.execute('''CREATE TABLE SCHOOL(
ID INTEGER PRIMARY KEY AUTOINCREMENT,
NAME TEXT NOT NULL,
AGE INTEGER NOT NULL,
ADDRESS CHAR(50));''')

# commit the update
connection.commit()<jupyter_output><empty_output><jupyter_text>Inserting records<jupyter_code># inserting record
cursor.execute("INSERT INTO SCHOOL (NAME, AGE, ADDRESS) \
                VALUES ('Ahmad', 14, 'Jakarta')")
cursor.execute("INSERT INTO SCHOOL (NAME, AGE, ADDRESS) \
                VALUES ('Robby', 15, 'Bandung')")
cursor.execute("INSERT INTO SCHOOL (NAME, AGE, ADDRESS) \
                VALUES ('Thomas', 13, 'Surabaya')")
cursor.execute("INSERT INTO SCHOOL (NAME, AGE, ADDRESS) \
                VALUES ('Laila', 15, 'Makasar')")

connection.commit()<jupyter_output><empty_output><jupyter_text>Selecting records<jupyter_code>for row in cursor.execute("SELECT ID, NAME, AGE FROM SCHOOL"):
    print("ID = ", row[0])
    print("NAME = ", row[1])
    print("MARKS = ", row[2], "\n")<jupyter_output><empty_output><jupyter_text>Updating records values<jupyter_code>connection.execute("UPDATE SCHOOL SET ADDRESS = 'Aceh' WHERE NAME = 'Laila'")
connection.commit()<jupyter_output><empty_output><jupyter_text>Deleting records<jupyter_code>connection.execute("DELETE FROM SCHOOL WHERE ID = 2")
connection.commit()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12780269058295965, 'fraction_numerical': 0.010089686098654708, 'mean_word_length': 5.735849056603773, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '372062', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 632, 'n_tokens_neox': 595, 'n_words': 142, 'path': '01 Relational Database_1.ipynb', 'repo_name': 'jogolapak/fox3', 'size': '1793'}