In: Computer Science
Create a SQLite Replit that creates a table representing students in a class, including at least name, graduation year, major, and GPA.
Include two queries searching this student data in different ways, for example searching for all students with graduation year of 2021, or all students with GPA above a certain number.
Here is an example you can work from: https://repl.it/@klmec/SQLExample (this is the default example from Replit; you can choose among several other examples when you create a new SQLite Replit).
SQLite Replit that creates a table representing students in a class
.header on
.mode column
/* CREATE command create the table students */
CREATE TABLE students (
name TEXT,
graduation_year INTEGER,
major char,
GPA float
);
/* INSERT command to populate student table with values */
INSERT INTO students VALUES
('Tom', 2001, 'computer', 6.8),
('Haary', 2002, 'Biology', 7.8),
('Denali', 2001, 'computer', 7.0),
('Ram', 2002, 'Networking',8.0),
('Geeta', 2002, 'computer',7.9),
('Sham', 2005, 'Networking',7.0);
/* SQL query to display records of students whose graduation year is 2002 */
.print 'all students with graduation year 2002'
SELECT *
FROM students
where graduation_year='2002'
order by GPA asc;
/* SQl query to display name and GPA of students whose GPA > 7.5 */
.print 'all students with GPA greater tha 7.5'
SELECT name, GPA
from students
where GPA>7.5;
OUTPUT
Please give me a thumbs up if this answer is helpful.