complete-sql-database-bootcamp-zero-to-mastery's People
Forkers
rangle-mobinni bassamkdev wandolfre jkis faisalahammad geps2705 shreeyabhandari bastiao5 cheram adilalam faizeerturk whateverwillian iamhassaan azfar1796 mbalazy pythonpractices-dev hymntaha bharathwaj-sankara ramarajupolanki ayazminhaj vishalkumar9dec derda187 mani22-bot mprodhan rodrigosql jaydenlim1993 golani04 github776 raghvender1205 meri-lin yashwant-s desi1174i martinpsz peacethekuma hannabm12 martinkeranov macrichie leocalil ankysri mandarvaze fatihtanriver ravindu-hirimuthugoda harikayen zbigniewsmierzchala t807209 shlongwani manueltorrestrs13 darkomihalec cacciari vickie7 mostafasamara tymurkorol vijaykumar1993 evolution99 venoflux kittudata brightchido dheerajqueries alexkanaantam vikrant121212 rozdolsky33 shakirmustafa andonise akile99 kofisena alin2683 sabinss maheshmore18992 henry-49 cpe342 neilkwashington3 gills4prem nandhdevineni ccmarcosa adevantae dgozen ifeanyi-omeck ankurp13 egizebunny ericlarson2020 youhakin rafaelatrivino mbea-int baoandeptrai123 holmesm8 bhindesa aydnkmnt kirat89 simvee darcioo25 ldsadiq pratikshafandi candrei1601 markogarza madhavjk tranquochuy2210 nadelaide josephfra aliko99 exunyccomplete-sql-database-bootcamp-zero-to-mastery's Issues
Clarification
Hi Mo,
Only a small clarification here - "Who is the oldest employee?" query is returning the age not the name of the oldest employee...
Your question is opening a challenge and accept it - I will come back with the solution.
Thanks.
Subqueries answer is wrong
Question:
/*
- DB: Employees
- Table: employees
- Question: Filter employees who have emp_no 110183 as a manager
*/
Answer:
-- Written with JOIN
SELECT e.emp_no, first_name, last_name
FROM employees as e
JOIN dept_emp as de USING (emp_no)
JOIN dept_manager as dm USING (dept_no)
WHERE dm.emp_no = 110183
In this answer, if we write it like that we will see all the employees who are in the department - d003.
In that dep are 2 managers. and emp_no = 110183 was manager only until 1992-03-21.
My resolution to this:
Select * from "public"."employees" as e
join dept_emp as de on de.emp_no = e.emp_no
join dept_manager as d on d.dept_no = de.dept_no
where d.emp_no = 110183 and de.to_date <= '1992-03-21'
.
Let me know if I'm wrong. Thank you
Answer clarification in date filtering exercise
Question:
/*
* DB: Employees
* Table: employees
* Question: Get me all the employees above 60, use the appropriate date functions
*/
I think this statement is asking to return all employees whose age is above 60 years.
So, as per the requirement 60 years 0 month 1 days should also count as age is above 60 years (60.0027397260274 after days converting in year) but answers provided returns results for those employees whose age is above >= 61 years.
I think the answer should be:
as it returns every employee with age above 60 counting days and months too.
First question in Operator Precedence is confusing
Hello. The first question in SQL Deep Dive/Operator precendence/questions.sql is a bit misleading after the update.
* Select people either under 30 or over 50 with an income above 50000
[added later on] Include people that are 50
* that are from either Japan or Australia
There are 3 options to read this after the update for their location filter:
- People under 30 or over/at 50 from either Japan or Australia
- People over/at 50 from either Japan or Australia
- People at exactly 50 from either Japan or Australia
The solution clearly reveals the logic that should be applied (location should apply to the entire range group <30 and >=50).
Please consider question update to avoid confusion for the students.
Correction of the question tense
Please change the question to Show me all the employees that have had more than 15 salary changes and have ever worked in the department development
The original sentence conveys showing the employees that are currently working in the "Development" department which is not the intended result and need an extra de.to_date > NOW()
condition:
SELECT e.emp_no, count(s.from_date) as "amount of raises"
FROM employees as e
JOIN salaries as s USING(emp_no)
JOIN dept_emp AS de USING(emp_no)
WHERE de.to_date > NOW() And de.dept_no = 'd005'
GROUP BY e.emp_no
HAVING count(s.from_date) > 15
ORDER BY e.emp_no;
Small update to answer :)
Question 1 - Average salary is a bit misleading
In the course we checked how many times one employee had an increase. So we already know there are multiple salary values per single employee. Getting simple AVG(salary) is also including historical values which will not give us the actual current value for average salary, instead average for the entire column. Not a good output if you are to answer the CEO asking how much we spend monthly on salaries (and you miss to report the extra ~10k).
Looking at the data itself the current salary of the employees has a to_date '9999-01-01' and adding a WHERE clause would give us accurate info.
As this is early on the course exercise I realize the goal is different and students should simply practice use of AVG. Maybe consider changing the question from
- What is the average salary for the company? to
- What is the all time average salary for the company?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.