Question

  • Creator
    Topic
  • #2138625

    sql developer

    Locked

    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.

All Answers

  • Author
    Replies
    • #2888008

      Clarifications

      by nitashagoud ·

      In reply to sql developer

      Clarifications

    • #2888007

      homework?

      by purpleskys ·

      In reply to sql developer

      already? textbooks or help files….

      • #2888006

        Reponse To Answer

        by nitashagoud ·

        In reply to homework?

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

      • #2887998

        Reponse To Answer

        by purpleskys ·

        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.

    • #2888005

      create the db

      by vgtsec ·

      In reply to sql developer

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

    • #2888004

      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.

      • #2888000

        Reponse To Answer

        by nitashagoud ·

        In reply to asking for help?

        i have given insert statement in that table

    • #2888003

      I think the answer is 42

      by slayer_ ·

      In reply to sql developer

      That’s the answer to everything.

    • #2887995

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

      by gharlow1 ·

      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.

    • #2887973

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

Viewing 6 reply threads