SQl question

  • Hello Guys,

    Can you help me to solve these questions?

    Employee Customer

    id name age salary id name city industry type

    1 ben 61 140000 4 bamsonic Cologne J

    2 bob 34 44000 6 ranasung Leslieburg J

    5 chris 34 40000 7 Vamony Arlington B

    7 Dan 41 52000 9 grange Marina B

    8 Ken 57 115000

    11 Joe 38 38000

    Order

    Id orderdate Customer_id Employee_id Amount

    10 8/2/2006 4 2 540

    20 1/30/2009 4 8 1800

    30 7/14/2005 9 1 460

    40 1/29/2008 7 2 2400

    50 2/3/2008 6 7 600

    60 3/2/2008 6 7 720

    70 5/6/2008 9 7 150

    a. The names of all employees that have an order with Bamsonic.

    b. The names of all employees that do not have any order with Bamsonic.

    c.The names of employees that have 2 or more orders.

    Write a SQL statement to insert rows into a table called high_value_employee(name,

    age), where an employee must have a salary of 100,000 or greater to be included in

    the table.

    e. Write the appropriate "CREATE TABLE" statements for all base tables (employee,

    customer, order) and shortly describe the choices you made.

    f. Which things would you personally improve about this schema? Where do you see

    potential problems

  • Is this a homework assignment? The people here are usually not going to do your homework for you, but if you make an attempt at doing the work yourself and get stuck then please post the specific question at that time



    Microsoft Certified Master - SQL Server 2008
    Follow me on twitter: @keith_tate

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Keith Tate (11/4/2013)


    Is this a homework assignment? The people here are usually not going to do your homework for you, but if you make an attempt at doing the work yourself and get stuck then please post the specific question at that time

    I agree with Keith. If you're learning then you need to put some effort towards it.

    Hint: Start with e.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Some of us could still help you if you had posted your question properly.

  • darwesh1992 (11/4/2013)


    Which things would you personally improve about this schema? Where do you see potential problems

    Ahh..it seems like its interview question's pool.:-D

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply