Question

Locked

sql developer

By nitashagoud ·
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.

This conversation is currently closed to new comments.

11 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Answers

Collapse -

homework?

by PurpleSkys Moderator In reply to sql developer

already? textbooks or help files....

Collapse -

Reponse To Answer

by nitashagoud In reply to homework?

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

Collapse -

Reponse To Answer

by PurpleSkys Moderator In reply to homework?

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.

Collapse -

create the db

by EzeXpl01t In reply to sql developer

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

Collapse -

asking for help?

by mlamboms In reply to sql developer

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.

Collapse -

Reponse To Answer

by nitashagoud In reply to asking for help?

i have given insert statement in that table

Collapse -

I think the answer is 42

by Slayer_ In reply to sql developer

That's the answer to everything.

Collapse -

Reponse To Answer

by PurpleSkys Moderator In reply to I think the answer is 42

including how the universe was created

Collapse -

Joins, Sums, Counts and NEVER allow dups to begin with

by gharlow In reply to sql developer

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.

Collapse -

i understood the logics..

by nitashagoud In reply to sql developer

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....:-)

Back to Web Development Forum
11 total posts (Page 1 of 2)   01 | 02   Next

Software Forums