List all the employees in the emp table


Assignment:

L_lunches table
LUNCH_ID LUNCH_DATE EMPLOYEE_ID DATE_ENTERED
1 16-NOV-05 201 13-OCT-05
2 16-NOV-05 207 13-OCT-05
3 16-NOV-05 203 13-OCT-05
4 16-NOV-05 204 13-OCT-05
6 16-NOV-05 202 13-OCT-05
7 16-NOV-05 210 13-OCT-05
8 25-NOV-05 201 14-OCT-05
9 25-NOV-05 208 14-OCT-05
12 25-NOV-05 204 14-OCT-05
13 25-NOV-05 207 18-OCT-05
15 25-NOV-05 205 21-OCT-05
16 05-DEC-05 201 21-OCT-05
17 05-DEC-05 210 21-OCT-05
20 05-DEC-05 205 24-OCT-05
21 05-DEC-05 203 24-OCT-05
22 05-DEC-05 208 24-OCT-05

L_lunch_items

LUNCH_ID ITEM_NUMBER SUPPLIER_ID PRODUCT_CODE QUANTITY
1 1 Asp Fs 1
1 2 Asp Sw 2
1 3 Jbr Vr 2
2 1 Asp Sw 2
2 2 Frv Ff 1
2 3 Jbr Vr 2
2 4 Vsb As 1
3 1 Asp Fs 1
3 2 Cbc Gs 1
3 3 Frv Ff 1
3 4 Jbr Vr 1
3 5 Jbr As 1
4 1 Asp Sp 2
4 2 Cbc Sw 2
4 3 Frv Ff 1
4 4 Jbr As 2
6 1 Asp Sp 1
6 2 Cbc Gs 1
6 3 Frv Ff 1
6 4 Jbr Vr 2
6 5 Vsb As 1
7 1 Asp Fs 1
7 2 Asp Sp 1
7 3 Cbc Gs 1
7 4 Jbr Vr 1
7 5 Vsb As 1
8 1 Asp Fs 1
8 2 Cbc Gs 1
8 3 Jbr As 1
9 1 Asp Fs 1
9 2 Asp Sp 1
9 3 Cbc Sw 2
9 4 Frv Ff 1
9 5 Jbr Vr 1
9 6 Jbr As 1
12 1 Asp Fs 1
12 2 Cbc Gs 1
12 3 Jbr Vr 2
12 4 Vsb As 1
13 1 Asp Sp 2
13 2 Asp Sw 2
13 3 Frv Ff 1
13 4 Jbr As 1
15 1 Asp Sp 1
15 2 Cbc Gs 1
15 3 Frv Ff 1
15 4 Jbr As 2
16 1 Asp Fs 1
16 2 Asp Sw 1
16 3 Cbc Sw 1
16 4 Jbr Vr 1
16 5 Jbr As 1
17 1 Asp Sp 1
17 2 Cbc Gs 1
17 3 Frv Ff 1
17 4 Jbr Vr 2
17 5 Vsb As 1
20 1 Asp Fs 1
20 2 Asp Sp 1
20 3 Cbc Gs 1
20 4 Frv Ff 1
20 5 Jbr As 1
21 1 Asp Sp 1
21 2 Cbc Gs 1
21 3 Jbr Vr 2
21 4 Vsb As 1
22 1 Asp Fs 1
22 2 Cbc Gs 1
22 3 Frv Ff 1
22 4 Jbr Vr 1
22 5 Jbr As 1

L_suppliers

SUPPLIER_ID SUPPLIER_NAME
Arr Alice & Ray's Restaurant
Asp A Soup Place
Cbc Certified Beef Company
Frv Frank Reed's VegeTABLEs
Fsn Frank & Sons
Jbr Just Beverages
Jps Jim Parker's Shop
Vsb Virginia Street Bakery

Q1. List all the employees in the emp table. If they work for department Accounting, then add 1200 to their salary. If they work for department Sales, then add 100 to their salary, otherwise add nothing to their salary.

Q2. List all the suppliers and the foods that they supply from the l_foods table. If supplier_id ASP provides the food, add 1 dollar to his price. If supplier_id, CBC supplies the food, add 2 dollars to his price. Otherwise, just show the price as is.

Q3. List the employee_id and employee_name of the employees form the l_employees table with the top 4 credit limits.

Q4. Change your answer from above to list those employees with the bottom 4 credit limits.

Q5. From the project, project_hours, and employee table, list the all the projects, the hours worked, and the date worked. (You will need this for the project).

Q6. Using the Lunches database, find the total amount spent on lunches by each employee. Show first_name, last_name, credit_limit, and total_price_spent in your results. Order your answer by total_price_spent in descending order. Only show the employees
who spent more than their credit limit (Modify question 9 from the last homework.)

Q7. Using the Lunches database, count the number of foods supplied by each supplier. List all the suppliers. Show the supplier_id, supplier_name, and number of foods from each supplier. Sort the rows on the supplier_id. Make sure you count all suppliers, even if they don't supply foods.

Q8. Using the Lunches database, count the number of employees who work in each department. List all the departments. Show the department code, department name, and the number of employees. Sort on the dept_code. Make sure you count all employees, regardless of whether they work for departments or not.

Solution Preview :

Prepared by a verified Expert
PL-SQL Programming: List all the employees in the emp table
Reference No:- TGS01939004

Now Priced at $30 (50% Discount)

Recommended (92%)

Rated (4.4/5)