PW Akshay

Generation

generate functionFri, 02 Dec 2022

Create a student table and insert data. Implement the following SQL commands on the student table: o ALTER table to add new attributes / modify data type / drop attribute o UPDATE table to modify data o ORDER By to display data in ascending / descending order o DELETE to remove tuple(s) o GROUP BY and find the min, max, sum, count and averag

import sqlite3 conn = sqlite3.connect('student.db') print("Opened database successfully") conn.execute('''CREATE TABLE STUDENT (ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, AGE INT NOT NULL, ADDRESS CHAR(50), MARKS INT);''') print("Table created successfully") conn.execute("INSERT INTO STUDENT (ID,NAME,AGE,ADDRESS,MARKS) \ VALUES (1, 'Paul', 32, 'California', 200)"); conn.execute("INSERT INTO STUDENT (ID,NAME,AGE,ADDRESS,MARKS) \ VALUES (2, 'Allen', 25, 'Texas', 500)"); conn.execute("INSERT INTO STUDENT (ID,NAME,AGE,ADDRESS,MARKS) \ VALUES (3, 'Teddy', 23, 'Norway', 200)"); conn.execute("INSERT INTO STUDENT (ID,NAME

Questions about programming?Chat with your personal AI assistant