<jupyter_start><jupyter_text>DatabaseRDMS(Relationnal database Manageament system) **open source**- MySQL(web and php)- PostgreSQL(entreprise level)- SQLITE(android app/ desktop app)**Proprietary**- MSSQL- Oracle<jupyter_code>import sqlite3
#driver is being imported
#psycopg2 for protsgeSQl
#pymysql for mySQL
conn= sqlite3.connect('example.sqlite3')
#if the give nname of file exits it load s the file else it creates the file
cur= conn.cursor()
#like pointer
cur.execute('CREATE TABLE countries(id integer, name text,iso3 text)')
#creates a table with columns id name and iso3
cur.execute('SELECT * FROM countries')
cur.fetchall()
#data not entered in our table
cur.execute('INSERT INTO countries(id,name,iso3)VALUES(1,"Nepal","NEP")')
cur.execute('SELECT * FROM countries')
cur.fetchall()
sql='''INSERT INTO countries (id,name,iso3) VALUES (?,?,?)'''
cur.executemany(sql,[(2,'India','INA'),
                     (3,'Bhutan','BHU'),
                     (4,'Afghanistan','AFG')])
cur.execute('SELECT * FROM countries')
cur.fetchall()
sql='''INSERT INTO countries (id,name,iso3) VALUES (4,'Pakistan','PAK')'''
cur.execute(sql)
cur.execute('SELECT * FROM countries')
cur.fetchall()
sql='UPDATE countries SET id=5 WHERE iso3= "PAK"'
cur.execute(sql)
cur.execute('SELECT * FROM countries')
cur.fetchall()
conn.commit()
#to write in the database
cur.execute('SELECT * FROM countries WHERE id=4')
cur.fetchall()
cur.execute('SELECT * FROM countries WHERE id>3')
cur.fetchall()
cur.execute('SELECT * FROM countries WHERE name LIKE "%an"')
cur.fetchall()
cur.execute('SELECT * FROM countries WHERE name LIKE "%an%"')
cur.fetchall()
#  last ma ra 1st ma  j bhaye ni huncha
cur.execute('SELECT * FROM countries WHERE name LIKE "an%"')
cur.fetchall()
# must start with an 
cur.execute('DELETE FROM countries')
cur.fetchall()
import csv
sql='INSERT INTO  countries (id,name ,iso3) VALUES (?,?,?)'
_id= 1
with open('netdata.txt','r') as datafile:
    csvfile=csv.DictReader(datafile)
    for row in csvfile:
        if row['Common Name'] and row['ISO 3166-1 3 Letter Code']:
            cur.execute(sql, (_id, row['Common Name'], row['ISO 3166-1 3 Letter Code']))
            _id+=1
conn.commit()
cur.execute('SELECT * FROM countries')
cur.fetchall()
cur.execute('DELETE FROM country_list')
cur.fetchall()
sql= '''CREATE TABLE
country_list (id integer primary key autoincrement,
country_name text not null,
iso3 text not null unique)'''
cur.execute(sql)
sql='INSERT INTO  country_list (country_name ,iso3) VALUES (?,?)'
with open('netdata.txt','r') as datafile:
    csvfile=csv.DictReader(datafile)
    for row in csvfile:
        if row['Common Name'] and row['Formal Name']:
            cur.execute(sql, (row['Common Name'], row['Formal Name']))
conn.commit()
cur.execute('SELECT * FROM country_list')
cur.fetchall()
sql='''INSERT INTO country_list (id,country_name,iso3) VALUES (595, 'Reunion', 'Overseas Region of Reunion')'''
cur.execute(sql)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15133131108864173, 'fraction_numerical': 0.013481631277384564, 'mean_word_length': 5.261603375527426, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '608780', 'license': 'MIT', 'n_tokens_mistral': 999, 'n_tokens_neox': 950, 'n_words': 287, 'path': 'class 4.ipynb', 'repo_name': 'suraviregmi/GIT_pythonsession', 'size': '2967'}