попробуй так:
#import sqlite3 module
import sqlite3
#Db connection
db = sqlite3.connect('database.db')
cursor = db.cursor()
#Create table
cursor.execute(
'''
CREATE TABLE IF NOT EXISTS username (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
age TEXT NOT NULL,
phone TEXT);
'''
)
#Insert your name
cursor.execute(
'''
INSERT INTO username (name, age, phone)
VALUES ("Abhishek", "18", "+123456789")
'''
)
#Commit previous table creation
db.commit()
#Select all from username table where name column is like 'Abhishek'
myname = 'Abhishek'
sql = f"SELECT * FROM username WHERE name='{myname}'"
#Alternative you can prepare sql like this, attention in quotes('var') aroud myname variable
sql = "SELECT * FROM username WHERE name='{}'".format(myname)
cursor.execute(sql)
#Get all results
result = cursor.fetchall()
for i in result:
print(i)