Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

INF3707_TL_202_2011_1_ SCHOOL OF COMPUTING.

Beoordeling
-
Verkocht
-
Pagina's
11
Cijfer
A+
Geüpload op
19-03-2022
Geschreven in
2021/2022

INF3707_TL_202_2011_1_ SCHOOL OF COMPUTING. 2 Lecturers responsible for INF3707 The lecturers are Mr Baldreck Chipangura and Dr E Kritzinger. Please phone us on or send e‐mails to INF3707/202/1/2010 3 | Page 3. Assignment 2 Question 1 (Lesson 4) a. The Human Resources department needs a report that displays the job ID and the average monthly salary for each job that has an average payroll that is between 5000 and 10000. The report should not include clerks. Sort the list in descending order of average salary. Sample results are shown below. Save your query as Q1A.SQL. [6] Solution select job_id, avg(salary)"Average salary" from employees where job_id not like '%CLER%' group by job_id having avg(salary) between 5000 and 10000 order by avg(salary)desc b. Create a query that displays the minimum, maximum, and total salary for each job type and the date the query was run. Sample results are shown below. Save your query as Q1B.SQl. [4] JOB_ID MINIMUM MAXIMUM SUM Date IT_PROG -APR-10 AC_MGR -APR-10 AC_ACCOUNT -APR-10 ST_MAN -APR-10 PU_MAN -APR-10 AD_ASST -APR-10 AD_VP -APR-10 SH_CLERK -APR-10 FI_ACCOUNT -APR-10 FI_MGR -APR-10 More than 10 rows available. Increase rows selector to view more rows. JOB_ID Average Salary IT_PROG 5760 MK_REP 6000 HR_REP 6500 ST_MAN 7280 FI_ACCOUNT 7920 AC_ACCOUNT 8300 SA_REP 8350 PR_REP 10000 INF3707/202/1/2010 4 | Page Solution select job_id, min(salary) Minimum, max(salary) Maximum, sum(salary) Sum, sysdate “Date” from employees group by job_id Question 2 (Lesson 6) The human Resources department needs to find the names and hire dates for all employees who were hired before 29 January 2000, along with their managers’ names. Sample results are shown in the table below. Save your query as Q2A.SQL. [6] Worker Name Hire Date Manager Name Kochhar 21-SEP-89 King De Haan 13-JAN-93 King Hunold 03-JAN-90 De Haan Ernst 21-MAY-91 Hunold Austin 25-JUN-97 Hunold Pataballa 05-FEB-98 Hunold Lorentz 07-FEB-99 Hunold Greenberg 17-AUG-94 Kochhar Faviet 16-AUG-94 Greenberg Chen 28-SEP-97 Greenberg More than 10 rows available. Increase rows selector to view more rows Solution select _name "Worker Name", _date "Hire Date", _name "Manager Name" from employees w join employees m on er_id = yee_id where _date = '29-JAN-2000' INF3707/202/1/2010 5 | Page Question 3 (Lesson 6) The Human Resources department requires you for find details of employees who earn salary that is more than the average salary for each department. Sample results are shown in the table below. Save your query as Q3A.SQL. [6] LAST_NAME SALARY DEPARTMENT_ID King 24000 90 Kochhar 17000 90 De Haan 17000 90 Russell 14000 80 Partners 13500 80 Hartstein 13000 20 Greenberg Errazuriz 12000 80 Higgins Ozer 11500 80 More than 10 rows available. Increase rows selector to view more rows Solution select last_name, salary, department_id from employees where salary = any (select round(avg(salary),2) from employees group by department_id) //alternative answer select _name, tment_id from employees a where salary (select avg(y) from employees b where tment_id = tment_id group by tment_id) order by y desc INF3707/202/1/2010 6 | Page Question 4 (Lesson 7) a. The job history table keeps record of the employees that filled other positions (job_id’s) within the organization. Use one of the set operators to list the employee information (name and last name) for all those employees that have never filled any other position within the organization .The report must list the employee_id and employee last name and first name. Order the list by the employee_id. Save the SQL as A2Q2A. [4] b. Use one of the set operators to list the names of all the employees that are in the Shipping Department and reports to Steven King. Sort the report alphabetically according to the last name of the employee. Save the SQL as A2Q2B. [4] Solution a. select employee_id, last_name, first_name from employees MINUS select employee_id,TO_CHAR(NULL), TO_CHAR(NULL) from job_history order by employee_id; // alternative select employee_id, last_name, first_name from employees where employee_id in (select employee_id from employees MINUS select distinct employee_id from job_history) order by 1 asc b. select last_name,first_name from employees where manager_id = 100 intersect select last_name,first_name from employees where department_id = 90 order by last_name; INF3707/202/1/2010 7 | Page Question 5 (lesson 8) a. Run the statement in the lab_08_ scripts to build the MY_EMPLOYEE table to be used for the lab. [2] b. Describe the structure of the table to identify the column names. [2] c. Write an insert statement in a dynamic reusable script file to load rows into the MY_EMPLOYEE table. Save your script as Q5C.SQL [2] Solution a. run the script b. describe My_EMPLOEE Table Column Data Type Leng th Precis ion Sca le Primary Key Nulla ble Defa ult Comm ent MY_EMPLOYE E ID Number - 4 0 - - - - LAST_NA ME Varchar2 25 - - - - - FIRST_N AME Varchar2 25 - - - - - USERID Varchar2 8 - - - - - SALARY Number - 9 2 - - - 1 - 5 c. insert into my_employee values(:id, :first_name,:last_name,:userid, :salry) INF3707/202/1/2010 8 | Page Question 6(Lesson 9) Create the EMPLOYEES_2 table based on the structure of the EMPLOYEES table. Include only the employees_id, initial of first name, last name, the last four digits of the phone number, salary dived by 2, and department id. Name the columns in the new table as ID, INITIAL, SURNAME, PHONE EXTENSION, SALARY, DEPRTMENT. Save the SQL as Q6A.SQL.

Meer zien Lees minder
Instelling
University Of South Africa
Vak
INF3707 SCHOOL OF COMPUTING (INF3707)









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
University of South Africa
Vak
INF3707 SCHOOL OF COMPUTING (INF3707)

Documentinformatie

Geüpload op
19 maart 2022
Aantal pagina's
11
Geschreven in
2021/2022
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

€3,70
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
DoctorReinhad Chamberlain College Of Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
2156
Lid sinds
4 jaar
Aantal volgers
1728
Documenten
5903
Laatst verkocht
1 dag geleden
TOP SELLER CENTER

Welcome All to this page. Here you will find ; ALL DOCUMENTS, PACKAGE DEALS, FLASHCARDS AND 100% REVISED & CORRECT STUDY MATERIALS GUARANTEED A+. NB: ALWAYS WRITE A GOOD REVIEW WHEN YOU FIND MY DOCUMENTS OF SUCCOUR TO YOU. ALSO, REFER YOUR COLLEGUES TO MY ACCOUNT. ( Refer 3 and get 1 free document). AM AVAILABLE TO SERVE YOU ANY TIME. WISHING YOU SUCCESS IN YOUR STUDIES. THANK YOU.

3,7

299 beoordelingen

5
132
4
50
3
53
2
17
1
47

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen