Spring Assignment
Spring Assignment
SPRING ASSIGNMENT
Submission Date and Time: 22-APRIL-2019 / 11:59 pm
- No assignment will be received after the due date.
(This is ASSIGNMENT for Lab so those students who are enrolled in just subject are not supposed
to do this assignment)
SUBMISSION CRITERIA
1. Make a word file and name it as BSEF17M5**
2. Copy/Paste the question of query with proper question number
3. Copy/Paste the answer of that query.
4. Attach the screenshot of that particular query.
5. Finally email your WORD file at [email protected]
6. All done
NOTE:
Create these tables on your ORACLE DESKTOP and add 10 rows in them. The data in the
rows will be of your own choice. The column name and table name should be same as given.
a) Find the names, street address, and cities of residence for all employees who work for
'First Bank Corporation' and earn more than $10,000.
b) Find the names of all employees in the database who live in the same cities as the
FARHAN-CH,PUCIT-NC 1
companies for which they work.
c) Find the names of all employees in the database who live in the same cities and on the
same streets as do their managers.
d) Find the names of all employees in the database who do not work for 'First Bank
Corporation'. Assume that all people work for exactly one company.
e) Find the names of all employees in the database who earn more than every employee
of 'Small Bank Corporation'. Assume that all people work for at most one company.
f) Assume that the companies may be located in several cities. Find all companies
located in every city in which 'Small Bank Corporation' is located.
g) Find the names of all employees who earn more than the average salary of all
employees of their company. Assume that all people work for at most one company.
h) Find the name of the company that has the smallest payroll.
2. For the following relation schema:
Customers (customer-id,first-name,last-name,birth-date,join-date,city,state,street,main-
phone-no,secondary-phn-num,fax,monthly-discount,pack-id)
Pack-grades(grade-id,grade-name,min-price,max-price)
packages(pack-id,speed,strt-date,monthly-payment,sector-id)
sectors(sector-id,sector-name)
NOTE:
Create these tables on your ORACLE DESKTOP and add 10 rows in them. The data in the
rows will be of your own choice. The column name and table name should be same as given.
1. Display the customer number, first name in lowercase and last name in uppercase for all
customers whose customer number is in the range of 80 and 150.
FARHAN-CH,PUCIT-NC 2
b. For all customers – display the last name, first name and email address. The email
address will be composed from the first letter of first name concatenated with
three last letters of last name concatenated with the string “@mymail.com” (For example
: Ram Kedem → [email protected]).
3. Display the last name and the length of the last name for all customers where last name’s
length is greater than 9 characters.
7. Display the first name, last name, city and state for all customers who live in the same state
as customer number 170 (Customers table).
8. Display the package number, internet speed and sector number for all packages whose sector
number equals to the sector number of package number 10 (Packages table).
9. Display the first name, last name and join date for all customers who joined the company
after customer number 540 (Customers table).
a. Write a query to display first name, last name, package number and internet
speed for all customers.
b. Write a query to display first name, last name, package number and internet
speed for all customers whose package number equals 22 or 27. Order the
query in ascending order by last name.
FARHAN-CH,PUCIT-NC 3
12. Display the last name, first name, join date, package number, internet speed and sector
name for all customers in the private sector who joined the company in the year 2006.
FARHAN-CH,PUCIT-NC 4