automated commit by check50 [check50=True]
This commit is contained in:
2
3.sql
2
3.sql
@@ -3,7 +3,7 @@
|
|||||||
-- Note that there may be two players with the name “Ken Griffey.” This Ken Griffey was born in 1969.
|
-- Note that there may be two players with the name “Ken Griffey.” This Ken Griffey was born in 1969.
|
||||||
-- Your query should return a table with two columns, one for year and one for home runs.
|
-- Your query should return a table with two columns, one for year and one for home runs.
|
||||||
SELECT perf."year", perf."hr"
|
SELECT perf."year", perf."hr"
|
||||||
FROM "performances" as perf
|
FROM "performances" AS perf
|
||||||
JOIN "players" AS p
|
JOIN "players" AS p
|
||||||
ON perf."player_id" = p."id"
|
ON perf."player_id" = p."id"
|
||||||
WHERE
|
WHERE
|
||||||
|
|||||||
4
4.sql
4
4.sql
@@ -5,8 +5,8 @@
|
|||||||
-- Your query should return three columns, one for players’ first names, one for their last names, and one for their salaries.
|
-- Your query should return three columns, one for players’ first names, one for their last names, and one for their salaries.
|
||||||
SELECT
|
SELECT
|
||||||
p."first_name", p."last_name", s."salary"
|
p."first_name", p."last_name", s."salary"
|
||||||
FROM "players" as p
|
FROM "players" AS p
|
||||||
JOIN "salaries" as s
|
JOIN "salaries" AS s
|
||||||
ON s."player_id" = p."id"
|
ON s."player_id" = p."id"
|
||||||
WHERE s."year" = "2001"
|
WHERE s."year" = "2001"
|
||||||
ORDER BY s."salary" ASC, p."first_name" ASC, p."last_name" ASC, p."id" ASC
|
ORDER BY s."salary" ASC, p."first_name" ASC, p."last_name" ASC, p."id" ASC
|
||||||
|
|||||||
6
5.sql
6
5.sql
@@ -1,9 +1,9 @@
|
|||||||
-- write a SQL query to find all teams that Satchel Paige played for.
|
-- write a SQL query to find all teams that Satchel Paige played for.
|
||||||
-- Your query should return a table with a single column, one for the name of the teams.
|
-- Your query should return a table with a single column, one for the name of the teams.
|
||||||
SELECT DISTINCT t."name"
|
SELECT DISTINCT t."name"
|
||||||
FROM "teams" as t
|
FROM "teams" AS t
|
||||||
JOIN "performances" as perf
|
JOIN "performances" AS perf
|
||||||
ON perf."team_id" = t."id"
|
ON perf."team_id" = t."id"
|
||||||
JOIN "players" as p
|
JOIN "players" AS p
|
||||||
ON p."id" = perf."player_id"
|
ON p."id" = perf."player_id"
|
||||||
WHERE p."first_name" = "Satchel" AND p."last_name" = "Paige";
|
WHERE p."first_name" = "Satchel" AND p."last_name" = "Paige";
|
||||||
|
|||||||
11
6.sql
11
6.sql
@@ -0,0 +1,11 @@
|
|||||||
|
-- write a SQL query to return the top 5 teams, sorted by the total number of hits by players in 2001.
|
||||||
|
-- Call the column representing total hits by players in 2001 “total hits”.
|
||||||
|
-- Sort by total hits, highest to lowest.
|
||||||
|
-- Your query should return two columns, one for the teams’ names and one for their total hits in 2001.
|
||||||
|
SELECT t."name", perf."H" AS "total hits"
|
||||||
|
FROM "teams" AS t
|
||||||
|
JOIN "performances" AS perf
|
||||||
|
ON perf."team_id" = t."id"
|
||||||
|
WHERE perf."year" = "2001"
|
||||||
|
ORDER BY "total hits" DESC
|
||||||
|
LIMIT 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user