· 7 years ago · Jan 19, 2019, 02:50 AM
1# Given the following data definition, write a query that returns the number of students whose first name is John.
2
3
4-- DROP TABLE IF EXISTS students;
5-- CREATE TABLE students (
6-- id INTEGER PRIMARY KEY,
7-- firstName VARCHAR(30) NOT NULL,
8-- lastName VARCHAR(30) NOT NULL
9-- );
10--
11-- INSERT INTO students VALUES(1, "John", "Doe");
12-- INSERT INTO students VALUES(2, "Vinita", "Boag");
13-- INSERT INTO students VALUES(3, "John", "Flarity");
14-- INSERT INTO students VALUES(4, "Gustav", "Spaunton");
15-- INSERT INTO students VALUES(5, "Ronald", "Vannikov");
16-- INSERT INTO students VALUES(6, "Corny", "Northage");
17-- INSERT INTO students VALUES(7, "Gardiner", "Chinnock");
18-- INSERT INTO students VALUES(8, "Colan", "Judkin");
19-- INSERT INTO students VALUES(9, "Johny", "Fullegar");
20-- INSERT INTO students VALUES(10, "Lavinie", "Carruth");
21-- INSERT INTO students VALUES(11, "Knox", "Halm");
22-- INSERT INTO students VALUES(12, "Halm", "Halm");
23
24
25SELECT * FROM students WHERE LOWER(students.firstName) = LOWER("john")