Question Locked

sql developer

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i have 3 tables with key relations

create table dbo.sale
1,'anday',61,1000
2,'rachod',34,2000
5,'chris',24,3000
7,'corms',41,4000
8,'ross',57,5000
9,'joe',38,6000
/*************************/
create table dbo.client
4,'pizza','holland','f&b'
5,'domino','chicago','f&b'
7,'pizzacornar','newyork','f&b'
9,'papa johns','miching','f&b'
/****************************/
create table dbo.orders
10,'8/2/96',4,2,540
20,'1/30/99',4,8,1800
30,'7/14/95',9,1,460
40,'1/29/98',7,2,2400
50,'2/3/98',6,7,600
60,'3/2/98',6,7,720
70,'5/6/98',9,7,150
60,'3/2/98',6,7,720

and give the answers for this questions
Q 1. names of all saleperson who have an order with dominos
Q2. the names all saleperson who do not have any order with Dominos& papa johns
Q3. the names of sales person that have 2 or more orders worth $150
Q4. write sql trigger to insert rows into a table called higher
achiever (names,age)
when a sale person sales amount gooes abouve $500

Q5. write queries to delete any duplicate rows the orders table

Q6. names of the saleperson who have not made any sales or sales less
then $50 in each year

please answer for this question and explain it for each question.

11 replies

by nitashagoud

m lerner of sql. can u give the answers for that questions.

by purpleskys

nitashagoud, we're not in the habit of doing your homework for you; it would be counterproductive as you wouldn't learn anything from one of us doing it FOR you. You have your text books and help files, and at a stretch, you have Google.

by vgtsec

Just create the database and run the queries and you will have the answers.

by mlamboms

when asking questions of this sort you should at least provide the FULL create table statements for your tables as well as the insert statements. makes things easier.

by gharlow1

You will use Joins to link your records and sums and counts to get the criteria.

When inserting IF EXISTS ... before allowing an insert to prevent dups.

Apart from that you have not defined your schema so the rest is pretty much following the chain of queries logically.

by nitashagoud

1. names of all saleperson who have an order with dominos

select S.[Name],S.SaleId,C.ClientName,O.ClientId
from dbo.orders O
INNER JOIN dbo.client C
ON C.ClientId = O.ClientId
INNER JOIN dbo.sale S
ON S.SaleId = O.SaleId
where C.ClientName ='Domino'

2. the names all saleperson who do not have any order with Dominos& papa johns

select S.[Name],S.SaleId,C.ClientName,O.ClientId
from dbo.orders O
INNER JOIN dbo.client C
ON C.ClientId = O.ClientId
INNER JOIN dbo.sale S
ON S.SaleId = O.SaleId
where C.ClientName NOT IN('Domino','papa johns')

Thanq u for all suggistions and i tryed for my answers and i get it....:-)

This discussion is closed to new replies.