This commit is contained in:
commit
cb1e07499c
12 files changed
+17
No files matched your search
@@ -0,0 +1,8 @@
|
||||
-- write a SQL query to find the average player salary by year.
|
||||
-- Sort by year in descending order.
|
||||
-- Round the salary to two decimal places and call the column “average salary”.
|
||||
-- Your query should return a table with two columns, one for year and one for average salary.
|
||||
SELECT "year", ROUND(AVG("salary"), 2) AS "average salary"
|
||||
FROM "salaries"
|
||||
GROUP BY "year"
|
||||
ORDER BY "year" DESC;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- write a SQL query to find Cal Ripken Jr.’s salary history.
|
||||
-- Sort by year in descending order.
|
||||
-- Your query should return a table with two columns, one for year and one for salary.
|
||||
SELECT "year", "salary"
|
||||
FROM "salaries" AS s
|
||||
JOIN "players" AS p
|
||||
ON s."player_id" = p."id"
|
||||
WHERE p."first_name" = "Cal" AND p."last_name" LIKE "Ripken%"
|
||||
ORDER BY "year" DESC;
|
||||
Reference in new issue
Block a user