0% found this document useful (0 votes)
8 views

SQL QUERIES

The document outlines a series of SQL queries based on various relational schemas, including employees, companies, and salespersons. It requires finding specific information such as employee details based on company and salary, company locations, and salespersons with certain order conditions. Each section presents different queries to extract or manipulate data from the specified tables.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

SQL QUERIES

The document outlines a series of SQL queries based on various relational schemas, including employees, companies, and salespersons. It requires finding specific information such as employee details based on company and salary, company locations, and salespersons with certain order conditions. Each section presents different queries to extract or manipulate data from the specified tables.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1)Consider the relational schema

Lives (person – name, street city)


Works (person – name, company – name, salary) Located – in (company –
name, city)
Manages (person – name, manager – name) with SQL to the following:
i) Find the name, street, city of all employees who work for 'IBM' & earn
more than
Rs. 15,000/-

ii) Find the name of all companies located in 'Nagpur'.

iii) Find those who lives and works in same city.

2)Consider the following relational database


SALESPERSON (Name, Percent_of_Quta, salary)
ORDER (Number, Custname, salespersonname, amount)
CUSTOMER (Name, city, Industrytype)
for each of the query given below, give the expression in SQL.
i) Find the names and quota percentages of salespeople who
have an order with ASIAN CONSTRUCTION in descending order
of quota percentage

ii) Find the quota percentage of salespeople who have an order


with a customer in MUMBAI

iii) Find the names of salespeople who have two or more orders

iv) Find the names of salespeople who have an order with all
customers.

3) Consider the following schema & answer the following SQL quires. Teacher (Tid, Tname
Cid, City, Sal, Subject)

1) Find the name of teachers who lives in 'Nagpur' and salary is greater than '15,000/-'
2)Find all teacher's who teacher 'DBMS'

3)Find the subject name whose name ends with char 's'.

4)Update the teacher city from 'Nagpur' to 'Pure' whose id is 5.

5) Find all the teachers salary in descending order.

4) Consider the relational schema Lives (person_name, street, city)

Works (person_name, company_name, salary) Located-in


(company_name, city)
Manages (person_name, manager_name) Write SQL to find the following.

i) Find the name, street, city of all employees who work for 'IBM' and earn
more tham
Rs. 15,000/-

ii) Find the name of all companies located in "Nagpur".

iii) Find those who lives and works in same city.

5) Consider the following relation for a database


employee ( emp _ name , street, city)
works ( emp _ name , company_name, salary)
company ( company _ name, city)
manager ( emp _ name , manager_name)
where the primary keys are underlined.
Give an expression in SQL for each of the following queries.
a) Find the names and cities of residence of all employees who work for
first Bank
corporation.

b) Find the names, street address and cities of residence of all employees
who work for
first Bank corporation and earn more than $10000.
c) Find the name of employee who works for 'IBM' and earns salary
greeter than 20,000

6) Consider the following relational database


SALESPERSON (Name, Percent_of_Quota, Salary)
ORDER (Number, Custname, Salespersonname, amount)
CUSTOMER (Name, City, Industrytype)

For each of the query given below, give expression in SQL.

i) Find the names and quota percentages of salespeople who have an order with

ASIAN CONSTRUCTION in descending order of quota percentage.

ii) Find the quota percentage of salespeople who have an order with a customer in
MUMBAI.

iii) Find the names of salespeople who have two or more orders.

iv) Find the names of salespeople who have an order with all customers

You might also like