These are chat archives for FreeCodeCamp/DataScience

27th
Sep 2017
Caleb Brenner
@cwborion
Sep 27 2017 23:23
anyone good with sql in here? I can’t find a free chatroom for sql anywhere.
Matthew Barlowe
@mcbarlowe
Sep 27 2017 23:23
I know some sql
I might be able to help @cwborion
Caleb Brenner
@cwborion
Sep 27 2017 23:25

alright awesome, I have a challenge for class that I’m very close to completing but need to implement part of the information with a subquery.

this is the challenge followed by my statement:

Please find all emp records that have a salary greater than 8000, and those hired after 1996 and please report the % of their salary as compared to the salary of the lowest salary.

Use subquery to find the lowest salary

SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, HIRE_DATE, SALARY,
(SALARY - min(SALARY) ) / min(SALARY) * 100 AS Percentage_Comparison FROM EMPLOYEES
WHERE SALARY > 8000
AND HIRE_DATE >= '01-JAN-97';

Matthew Barlowe
@mcbarlowe
Sep 27 2017 23:30
and what is your ouput what isn't coming out right?
Caleb Brenner
@cwborion
Sep 27 2017 23:31
not a single-group group function
Matthew Barlowe
@mcbarlowe
Sep 27 2017 23:34
well subqueries are usually written like this
SELECT *
    FROM (
            SELECT * from EMPLOYEES WHERE SALARY > 8000
) subquery
where subquery.hire_date >= '01-JAN-97'
Caleb Brenner
@cwborion
Sep 27 2017 23:37
I actually figured it out! thank you though!
Matthew Barlowe
@mcbarlowe
Sep 27 2017 23:39
Ok that's good best of luck
Caleb Brenner
@cwborion
Sep 27 2017 23:39
thank you @mcbarlowe
CamperBot
@camperbot
Sep 27 2017 23:39
cwborion sends brownie points to @mcbarlowe :sparkles: :thumbsup: :sparkles:
:cookie: 128 | @mcbarlowe |http://www.freecodecamp.com/mcbarlowe