Added missing files and removed unnessesary ones
This commit is contained in:
44
SQL/task1.sql
Normal file
44
SQL/task1.sql
Normal file
@ -0,0 +1,44 @@
|
||||
/* CREATE TABLE IF NOT EXISTS stations(
|
||||
id INT CONSTRAINT firstkey PRIMARY KEY,
|
||||
city VARCHAR(21),
|
||||
state VARCHAR(21),
|
||||
lat_n INT,
|
||||
long_w int
|
||||
);
|
||||
|
||||
INSERT INTO stations VALUES (794, 'Kissee Mills', 'MO', 140, 73),
|
||||
(824, 'Loma Mar', 'CA', 49, 131),
|
||||
(603, 'Sandy Hook', 'CT', 72, 148),
|
||||
(478, 'Tipton', 'IN', 34, 98),
|
||||
(619, 'Arlington', 'CO', 75, 93),
|
||||
(711, 'Turner', 'AR', 50, 101),
|
||||
(839, 'Slidell', 'LA', 85, 152),
|
||||
(411, 'Negreet', 'LA', 99, 105),
|
||||
(588, 'Glencoe', 'KY', 46, 136),
|
||||
(665, 'Chelsea', 'IA', 99, 60),
|
||||
(342, 'Chignik Lagoon', 'AK', 103, 153),
|
||||
(733, 'Pelahatchie', 'MS', 39, 28),
|
||||
(441, 'Hanna City', 'IL', 51, 137),
|
||||
(811, 'Dorrance', 'KS', 102, 122),
|
||||
(698, 'Albany', 'CA', 50, 80),
|
||||
(325, 'Monument', 'KS', 71, 142),
|
||||
(414, 'Manchester', 'MD', 74, 37),
|
||||
(113, 'Prescott', 'IA', 40, 66),
|
||||
(971, 'Graettinger', 'IA', 95, 150),
|
||||
(266, 'Cahone', 'CO', 116, 127),
|
||||
(617, 'Sturgis', 'MS', 36, 126),
|
||||
(495, 'Upperco', 'MD', 114, 30),
|
||||
(473, 'Highwood', 'IL', 27, 151),
|
||||
(756, 'Garden City', 'AL', 96, 105),
|
||||
(225, 'Garden City', 'IA', 54, 119);
|
||||
*/;
|
||||
SELECT city, state FROM stations;
|
||||
SELECT SUM(lat_n), SUM(long_W) FROM stations;
|
||||
SELECT city FROM stations WHERE id % 2 = 0;
|
||||
SELECT COUNT(city) - COUNT(DISTINCT(city)) FROM stations;
|
||||
SELECT lat_n FROM stations WHERE lat_n BETWEEN 39 AND 137;
|
||||
SELECT max(lat_n) FROM stations WHERE lat_n <= 137;
|
||||
SELECT min(lat_n) FROM stations WHERE lat_n >= 39;
|
||||
SELECT DISTINCT(city) FROM stations WHERE LOWER(RIGHT(city, 1)) in ('a', 'e', 'i', 'o', 'u', 'y');
|
||||
SELECT DISTINCT(city) FROM stations WHERE LOWER(RIGHT(city, 1)) IN ('a', 'e', 'i', 'o', 'u', 'y') AND LOWER(LEFT(city, 1)) IN ('a', 'e', 'i', 'o', 'u', 'y');
|
||||
SELECT DISTINCT(city) FROM stations WHERE LOWER(LEFT(city, 1)) NOT IN ('a', 'e', 'i', 'o', 'u', 'y');
|
Reference in New Issue
Block a user