import sqlite3;

# Connect to the SQLite database
conn = sqlite3.connect("student.db")
cursor = conn.cursor()

# Create a students table if it doesn't exist
cursor.execute('''CREATE TABLE IF NOT EXISTS students (
                    student_id INTEGER PRIMARY KEY,
                    first_name TEXT,
                    last_name TEXT,
                    age INTEGER,
                    grade REAL
                )''')
conn.commit()

# Function to add a new student record
def add_student(first_name, last_name, age, grade):
    cursor.execute("INSERT INTO students (first_name, last_name, age, grade) VALUES (?, ?, ?, ?)", (first_name, last_name, age, grade))
    conn.commit()

# Function to view all student records
def view_students():
    cursor.execute("SELECT * FROM students")
    students = cursor.fetchall()
    for student in students:
        print(student)

# Function to update a student record by student ID
def update_student(student_id, first_name, last_name, age, grade):
    cursor.execute("UPDATE students SET first_name = ?, last_name = ?, age = ?, grade = ? WHERE student_id = ?", (first_name, last_name, age, grade, student_id))
    conn.commit()

# Function to delete a student record by student ID
def delete_student(student_id):
    cursor.execute("DELETE FROM students WHERE student_id = ?", (student_id,))
    conn.commit()

# Main program loop
while True:
    print("\nOptions:")
    print("1. Add Student")
    print("2. View Students")
    print("3. Update Student")
    print("4. Delete Student")
    print("5. Quit")
    
    choice = int(input("Enter option: "))

    if choice == "1":
        first_name = input("Enter first name: ")
        last_name = input("Enter last name: ")
        age = int(input("Enter age: "))
        grade = float(input("Enter grade: "))
        add_student(first_name, last_name, age, grade)
    elif choice == "2":
        view_students()
    elif choice == "3":
        student_id = int(input("Enter student ID to update: "))
        first_name = input("Enter first name: ")
        last_name = input("Enter last name: ")
        age = int(input("Enter age: "))
        grade = float(input("Enter grade: "))
        update_student(student_id, first_name, last_name, age, grade)
    elif choice == "4":
        student_id = int(input("Enter student ID to delete: "))
        delete_student(student_id)
    elif choice == "5":
        break

# Close the database connection
conn.close()

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: