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 average

CREATE TABLE students ( id INTEGER, name TEXT, marks REAL ); INSERT INTO students (id, name, marks) VALUES (1, 'John Doe', 90.5); SELECT * FROM students; ALTER TABLE students ADD Class INTEGER; UPDATE students SET Class = 1 WHERE id = 1; UPDATE students SET marks = 100 WHERE id = 1; DELETE FROM students WHERE id = 1; SELECT * FROM students ORDER BY marks DESC; SELECT * FROM students ORDER BY marks ASC; SELECT avg(marks), min(marks), max(marks), sum(marks), count(*) FROM students;

Questions about programming?Chat with your personal AI assistant