SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQl question


SQl question

Author
Message
darwesh1992
darwesh1992
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1
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
Keith Tate
Keith Tate
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2222 Visits: 979
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
dwain.c
dwain.c
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16857 Visits: 6431
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!

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?
Since random numbers are too important to be left to chance, let's generate some!
Learn to understand recursive CTEs by example.
Splitting strings based on patterns can be fast!
My temporal SQL musings: Calendar Tables, an Easter SQL, Time Slots and Self-maintaining, Contiguous Effective Dates in Temporal Tables
T.Ashish
T.Ashish
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1321 Visits: 607
Some of us could still help you if you had posted your question properly.
Bhuvnesh
Bhuvnesh
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12576 Visits: 4077
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;-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search