<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>