Run lab_emp.sql and lab_students.sql, this will create 2 tables for you (emp and students) and will fill them with data.     create table emp ( eid number(7), fname char(20), lname char(20), salary   number, primary key (eid) ); insert into emp values (1111111, 'ali', 'ahmed', 3500); insert into emp values(2222222, 'asma', 'dani', 2000); insert into emp values(3333333, 'hassan', 'ali', 4500); insert into emp values(4444444, 'khaled', 'shaalan',6000); insert into emp values(5555555, 'farhad', 'kokol', 7500); insert into emp values(6666666, 'amir', 'sheikh', 10000); insert into emp values(7777777, 'rahul', 'kolap', 11000); insert into emp values(8888888, 'halim', 'ziaey', 21000); insert into emp values(9999999, 'henna', 'bubaker', 30000);     create table students ( sid number, fname char(20), lname char(20), avg   number, age number, primary key (sid) ); insert into students values (1111111, 'ali', 'ahmed', 76, 21); insert into students values(2222222, 'asma', 'dani', 89, 20); insert into students values(3333333, 'hassan', 'ali', 67, 23); insert into students values(4444444, 'khaled', 'shaalan',87, 24); insert into students values(5555555, 'farhad', 'kokol', 82, 19); insert into students values(6666666, 'amir', 'sheikh', 56, 18); insert into students values(7777777, 'rahul', 'kolap', 81, 22); insert into students values(8888888, 'halim', 'ziaey', 97, 21); insert into students values(9999999, 'henna', 'bubaker', 45, 18);

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
100%

Task 1:

Run lab_emp.sql and lab_students.sql, this will create 2 tables for you (emp and students) and will fill them with data.

 

 

create table emp (

eid number(7),

fname char(20),

lname char(20),

salary   number,

primary key (eid)

);

insert into emp values (1111111, 'ali', 'ahmed', 3500);

insert into emp values(2222222, 'asma', 'dani', 2000);

insert into emp values(3333333, 'hassan', 'ali', 4500);

insert into emp values(4444444, 'khaled', 'shaalan',6000);

insert into emp values(5555555, 'farhad', 'kokol', 7500);

insert into emp values(6666666, 'amir', 'sheikh', 10000);

insert into emp values(7777777, 'rahul', 'kolap', 11000);

insert into emp values(8888888, 'halim', 'ziaey', 21000);

insert into emp values(9999999, 'henna', 'bubaker', 30000);

 

 

create table students (

sid number,

fname char(20),

lname char(20),

avg   number,

age number,

primary key (sid)

);

insert into students values (1111111, 'ali', 'ahmed', 76, 21);

insert into students values(2222222, 'asma', 'dani', 89, 20);

insert into students values(3333333, 'hassan', 'ali', 67, 23);

insert into students values(4444444, 'khaled', 'shaalan',87, 24);

insert into students values(5555555, 'farhad', 'kokol', 82, 19);

insert into students values(6666666, 'amir', 'sheikh', 56, 18);

insert into students values(7777777, 'rahul', 'kolap', 81, 22);

insert into students values(8888888, 'halim', 'ziaey', 97, 21);

insert into students values(9999999, 'henna', 'bubaker', 45, 18);

 

Task 2:

Solve the following questions:

 

Question 1: (use loop)

Write a program that displays an appropriate message for a given employee based on the criteria given below use.

  • if (salary <= 4000) then ‘Low Income’
  • if (salary > 4000 and salary <=7000) then ‘Avg Income’
  • if (salary > 7000 and salary <= 15000) then ‘Moderate Income’
  • else ‘High Income’

 

Question 2: (use while loop)

Write a program to update the salary of all employees with salaries less than 7000:  salary = salary * ((pct/100) +1). (use for loop)

 

Question 3: (use for loop)

Write a program which shows the average of average for students whose age are 20 or below.

 

Question 4:

Write a program to get all male students and add 10% to their average if the average is 80 or above and 2% if the average is less than 80.

 

 

 

 

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education