1.
Write a SQL query to find all employee details from
the employee table order by Name Ascending and
Salary descending
2. Write a SQL query to Get employee details from
employee table whose name contains 'o‘
3. Write a SQL query to find employee details from
employee table whose first name ends with 'n' and
name contains 4 letters
4. Write a SQL query to find employee details from
employee table whose Salary greater than 8000
5. Write a SQL query to find employee details from
employee table whose Salary between 5000 and 8000
6. Write a SQL query to Get employee details from
employee table whose name is komal' and ‘koushik‘
7. Write a SQL query to find age wise maximum salary
from employee table order by salary ascending
8. Write a SQL query to find age wise average salary
from employee table order by salary ascending
9. Select age,total salary with respect to a age from
employee table where total salary greater than 2000
order by Total_Salary descending
10.Write a SQL query to get the second highest salary
from the Employee table.
employee (employee-name, street, city)
works (employee-name, company-name, salary)
company (company-name, city)
manages (employee-name, manager-name)
a)Delete all tuples in the works relation for employees
of abd.
b)Give all managers of „abc‟ a 10 percent raise unless
the salary becomes greater than 100,000;
c) Find those companies whose employees earn a higher
salary, on average,
than the average salary at „abc‟.
d). Find the company that has the most employees.
e). Find the company that has the smallest payroll.
f). Find those companies whose employees earn a higher
salary, on average,than the average salary at abc
Corporation.
g) Find all employees who earn more than the average
salary of all employees
h) Find all employees in the database who earn more
than each employee of
Small Bank Corporation.
--------------- --------------- ---------------------
Emp(emp_id,emp_name)
Project(P_name ,p_id)
Work(p_id,emp_id)
1)find the employee name who have participated
in all the projects.
2) Find the employee name who worked more than one
project.
3) Find the names of all instructors whose salary is
greater than at least one instructor in the Biology
department.
4)Find the departments that have the highest average
salary.
5) Find all employees in the database who live in the
same cities and on the same streets as do their
managers.
------------------ ------------ ---------------
Branch(b_name,city)
Customer(c_name,b_name )
account (account number, branch name, balance)
1.Find those tuple pertaining to loans of more than
5000 made by midnapore branch.
2.Delete all loan account amount in range 0 to 100.
3.Find all the customer name who has account at all the
branches located in midnapore.
4.Find the name of all branches that have assets
greater than at least one branch located in midnapore.
------------------ ----------------- ----------
1.find the employee name whose name starts with a or k
and salary greater than 5000
2.find the different age group available in this table.
3.find the emp name total salary and age
address and age wise and total salary will be greater
than 2000.
4. find the average salary who lives in delhi.
5.find the first four letter of the employee name who
lives in Mumbai.
Suppliers(sid, sname, address)
Parts(pid, pname, color)
Catalog(sid, pid, cost)
1. Find the pnames of parts for which there is some
supplier.
2. Find the snames of suppliers who supply every part.
3. Find the snames of suppliers who supply every red
part.
4. Find the pnames of parts supplied by Acme Widget
Suppliers and by no one else.
5. Find the sids of suppliers who charge more for some
part than the average cost of
that part (averaged over all the suppliers who supply
that part).
6. For each part, find the sname of the supplier who
charges the most for that part.
7. Find the sids of suppliers who supply only red
parts.
8. Find the sids of suppliers who supply a red part and
a green part.
9. Find the sids of suppliers who supply a red part or
a green part.
patient(P_id,p_name,p_age,p_add)
doctor(d_id,d_name,d_add,d_phn)
admitted(p_id,adm_date)
attend(p_id,d_id)
1. List the name of the patients descending order oof
sge with their doctor name
2.
list the doctors who checked the patients more than 2
times
list the doctors who treat the patients with date of
admission of admission between '' and ''
book(acc_no,title,publishers,authors,subject,no_copy)
borrower(card_no,b_name,b_add,b_phn)
issue(acc_no,card_no,date_of_issue,date_of_return)
Hotel (hotelNo,name,address)
Room (roomNo,hotelNo,type,price)
Booking (hotelNo,guestNo,dateFrom,dateTo,roomNo)
Guest (guestNo,name,address)
1.List the names and addresses of all guests in London
aplhabetically ordered by name.
List all double('D') or family rooms('F') with a price
below 40.00 per night, in ascending order of price
The following
query selects the names of instructors whose names are
neither “Mozart” nor
“Einstein”.
Find the names of all instructors whose salary is
greater than at least one
instructor in the Biology department.”
branch(branch name, branch city, assets)
customer(customer name, customer street,customer city)
loan (loan number, branch name, amount)
borrower (customer name, loan number)
account (account number, branch name, balance)
depositor (customer name, account number)
Find all loan numbers with a loan value greater than
$10,000.
b. Find the names of all depositors who have an account
with a value
greater than $6,000.
c. Find the names of all depositors who have an account
with a value
greater than $6,000 at the “Uptown” branch.
a. Find all customers who have an account at all the
branches located in
“Brooklyn”.
b. Find out the total sum of all loan amounts in the
bank.
c. Find the names of all branches that have assets
greater than those of
at least one branch located in “Brooklyn”.