Lab7 Iste436

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

1

SQL> select companyname, division from interview where interviewdate between TO_DATE('01-JAN-
22', 'DD-MON-YY') and TO_DATE('31-AUG-22', 'DD-MON-YY')
2 ;

DC Security Applications RandD


Davis-Klein Software RandD
Flordia Software Designs RandD
Rochester Software Design Development
Focused Applications, Inc. Production
Georgia Software Design RandD
ApplDesign RandD
Long Island Apps, Inc. Development
SQL>
2

SQL> select city from employer join interview on employer.companyname=interview.companyname


where interview.qtrcode=20221;

Myrtle Beach
Atlanta
Huntsville
Oceanside
Rochester

3.
SQL>
select distinct interview.qtrcode, interview.companyname, interview.division from interview join
employer on interview.companyname = employer.companyname where employer.zipcode like '100%'
COLUMN qtrcode HEADING 'Quarter Code'
COLUMN average_salary HEADING 'Average Salary'

2 ;

20223 Manhattan-Made Software Customer Support


20213 CCC Software Production
20213 Manhattan-Made Software Payroll

4
SQL> select qtrcode, avg(salaryoffered) as average from interview group by qtrcode order by qtrcode;

2021120.78125
20213 22.5714286
20221 21.9
20223 23.1666667
20224 24.05

5.
SELECT COMPANYNAME, DIVISION
FROM INTERVIEW
WHERE MINHRSOFFERED = (
SELECT MIN(MINHRSOFFERED)
FROM INTERVIEW
);

Bay Software Inc. Production


Mountainside Magic Software Management
Davis-Klein Software RandD

6
SQL> select companyname, division from interview join quarter on interview.qtrcode = quarter.qtrcode
where minhrsoffered = minhrs;

Acme Information Source Customer Support


Braddock Information Assoc. Payroll
Ajax Software, Inc. Production
Ajax Software, Inc. RandD
Vegas Programming and Design Development
Mountainside Magic Software Customer Support
DC Security Applications RandD
Flordia Software Designs RandD
Rochester Software Design Development
Focused Applications, Inc. Production
ApplDesign RandD
Manhattan-Made Software Customer Support
Nantucket Applications, Inc. RandD
PennState Programming, Inc. Management
Virginia Software Industries Production

7.
SQL> select distinct quarter.qtrcode, state.description, interview.companyname, interview.division,
interview.interviewdate from interview join employer on interview.companyname =
employer.companyname join quarter on interview.qtrcode = quarter.qtrcode join state on
employer.statecode = state.statecode join employer on quarter.location = state.statecode;

20221 NEW YORK Rochester Software Design Development 01-JUL-22


20221 NEW YORK Long Island Apps, Inc. Development 11-AUG-22
20224 NEW YORK Buffalo Software Assoc. Payroll 22-APR-23

8.
SQL> select quarter.qtrcode, MIN(interview.salaryoffered) as min from interview join quarter on
interview.qtrcode = quarter.qtrcode group by quarter.qtrcode;
20211 19.75
20221 21.25
20223 23
20213 20.75
20224 23.5

9.
SQL> select employer.city || ', ' || employer.statecode, employer.companyname, interview.division from
interview join employer on interview.companyname = employer.companyname where
employer.statecode in ('NY','MA','NJ','CT') and interview.minhrsoffered<40;

Sandy Hook, CT Sandy Hook Software Development


Lindenwold, NJ Jersey Computer Services Customer Support
Buffalo, NY Buffalo Software Assoc.Payroll
Cairo, NY Davis-Klein Software RandD
Rochester, NY Rochester Software Design Development

10.
SQL> select employer.city || ', ' || employer.statecode, employer.companyname, interview.division from
interview join employer on interview.companyname = employer.companyname where
employer.statecode in ('NY','MA','NJ','CT') and interview.minhrsoffered=40;

Boston, MA Braddock Information Assoc. Payroll


Nantucket, MA Nantucket Applications, Inc. RandD
New York, NY CCC Software Production
Oceanside, NY Long Island Apps, Inc. Development
New York, NY Manhattan-Made Software Customer Support
New York, NY Manhattan-Made Software Payroll
New York, NY Manhattan-Made Software Customer Support
New York, NY Manhattan-Made Software Payroll

11.
SQL> select quarter.qtrcode, MIN(interview.salaryoffered) as min, MAX(interview.salaryoffered) as
max, ROUND(AVG(interview.salaryoffered),2) as avg from interview join quarter on interview.qtrcode
= quarter.qtrcode group by quarter.qtrcode order by quarter.qtrcode;

20211 19.75 22 20.78


20213 20.75 24.5 22.57
20221 21.25 22.5 21.9
20223 23 23.5 23.17
20224 23.5 25.25 24.05

12
SQL> select employer.statecode, MIN(interview.salaryoffered) as min, MAX(interview.salaryoffered) as
max, ROUND(AVG(interview.salaryoffered),2) as avg from interview join employer on
interview.companyname = employer.companyname group by employer.statecode order by statecode;
AL 21.25 21.25 21.25
CA 20.25 21.75 21.08
CO 19.75 21.25 20.5
CT 23.5 23.5 23.5
FL 21.75 23.5 22.63
GA 21.75 21.75 21.75
MA 19.75 24 21.88
NJ 23 23 23
NV 20.25 20.25 20.25
NY 20.75 24.5 22.78
OH 22 22 22
PA 24 24 24
SC 22 22 22
TX 24 24.5 24.25
VA 21.25 25.25 23.25

13

SELECT
q.qtrcode,
q.minsal,
ROUND(AVG(i.salaryoffered), 2) AS avg_salary_offered
FROM
interview i
JOIN
quarter q ON i.qtrcode = q.qtrcode
GROUP BY
q.qtrcode, q.minsal
ORDER BY
q.qtrcode;

20211 20.25 20.78


20213 21.25 22.57
20221 22 21.9
20223 23.5 23.17
20224 24.75 24.05

14.
SELECT
q.qtrcode AS QTR,
COUNT(i.interviewid) AS INTERVIEWS,
(MAX(i.interviewdate)- MIN(i.interviewdate)) AS TOTAL_DAYS,
MIN(i.interviewdate) AS "FROM",
MAX(i.interviewdate) AS "TO"
FROM
interview i
JOIN
quarter q ON i.qtrcode = q.qtrcode
GROUP BY
q.qtrcode
ORDER BY
q.qtrcode;

20211 8 62 01-JUN-21 02-AUG-21


20213 7 427 01-DEC-21 01-FEB-23
20221 5 41 01-JUL-22 11-AUG-22
20223 3 30 01-JAN-23 31-JAN-23
20224 5 38 24-MAR-23 01-MAY-23

15.
SELECT
'For ' || q.qtrcode || ': ' ||
COUNT(i.interviewid) || ' interviews over ' ||
(MAX(i.interviewdate) - MIN(i.interviewdate)) || ' days, from ' ||
TO_CHAR(MIN(i.interviewdate), 'Month DD, YYYY') || ' to ' ||
TO_CHAR(MAX(i.interviewdate), 'Month DD, YYYY') AS output
FROM
interview i
JOIN
quarter q ON i.qtrcode = q.qtrcode
GROUP BY
q.qtrcode
ORDER BY
14 q.qtrcode;

For 20211: 8 interviews over 62 days, from June 01, 2021 to August 02, 2021
For 20213: 7 interviews over 427 days, from December 01, 2021 to February 01, 2023
For 20221: 5 interviews over 41 days, from July 01, 2022 to August 11, 2022
For 20223: 3 interviews over 30 days, from January 01, 2023 to January 31, 2023
For 20224: 5 interviews over 38 days, from March 24, 2023 to May 01, 2023

You might also like