October 12, 2013 at 4:20 am
i have a stone and this stone can be two type a circle stone that have this info:radius and center point(x,y) or Square stone that have this info:4 corner point(x,y) but id in both of them that is primary key is same.how can i create this entity??????
October 12, 2013 at 7:27 am
plz sm help
October 13, 2013 at 6:46 pm
It's not clear at all what you mean. You should provide a better description of what you are trying to model here.
October 13, 2013 at 7:17 pm
Could you possibly be needing to use a GEOMETRY data type as your primary key?
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
October 14, 2013 at 1:59 am
i mean how can i create stone table in ERD?????
October 14, 2013 at 12:51 pm
subclass? One table for Square, one for Circle. Get the entity ID from the parent table?
October 16, 2013 at 10:42 am
It isn't completely clear what you mean here. If you are just storing the points that describe a circle or square, you can easily create two tables. however from your information, you haven't described this well.
If I want a circle table, I really need the center and radius, as you mentioned. That's easy.
create table circles
( id int
, center_x int
, center _y int
)
I can do the same for squares, just deciding where to start recording (lower left, lower right, etc.)
If you are saying you want to store these in the same table, I'd argue that's a mistake in that you will have data in the row (fields) that don't apply to the entity. You might be better off with a linking table that contains a shapeID linking to one of these tables and a meta data field that describes this as a circle or square.
If you want in one table, I'd add a field that describes the type of shape. Then I'd do the math in a client method that finds the corners. If I have the center of a square and the radius to the side or the corner (you have to decide) I can calculate the corner points.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply