none
General Questions about my Database Design

    Question

  • Hello Friends

    I am a little bit hesitant on starting my project and then finding out that my current data base design does not allow the functionality I need. The project is for an online print shop (people can order prints online) here is the ERD.

    My main concerns are, would I be able to juggle between all the data types for all the attributes/properties ?

    Also, I noticed there is not BYTE data type. Would I have to choose VARBINARY(1024) instead ? And how big should I make the VARBINARY ? It is for the Artwork that people will be uploading for their print orders (mostly GIF, JPEG, and PDF files).

    And finally, over in the ASP.NET MVC forums, I have been told I should start with Entity Framework 4.0 Code First. What are your thoughts on this ?

    I would greatly appreciate some help.

    Thank You.


    Always wanting to Learn.
    • Moved by WeiLin Qiao Thursday, February 17, 2011 6:51 AM (From:Getting started with SQL Server)
    Monday, February 14, 2011 6:31 PM

Answers

All replies

  • My main concerns are, would I be able to juggle between all the data types for all the attributes/properties ?

    Don't see that this would be a problem; in fact it is important to have the correct data type for each attribute.

    And how big should I make the VARBINARY ?

    What about VARBINARY(MAX)? This is what I would use for big images.

    in the ASP.NET MVC forums,I have been told I should start with Entity Framework 4.0 Code First. What are your thoughts on this ?

    This answer reflects where you asked the question. In this forum, you would be more likely to be told that you should start with an E-R diagram.


    Twitter
    Monday, February 14, 2011 7:06 PM
  • Don't see that this would be a problem; in fact it is important to have the correct data type for each attribute.

    Yep it really is important, but the way I have my database right now, all the attributes are of type string. Do you reckon it is possible for me to convert from String to pretty much all the popular data types ?

    What about VARBINARY(MAX)? This is what I would use for big images.

    I did think of VARBINARY(MAX), but then I thought, why make the database bigger, when it doesn't need to be. But maybe I'm getting it wrong. Does VARBINARY(MAX) only take up space as much as it needs ?

    This answer reflects where you asked the question. In this forum, you would be more likely to be told that you should start with an E-R diagram.

    Hehe Yes you are right there. I think what they meant though was First get ERD then start with the Entity Framework 4.0 code. But here maybe you'll say Get the ERD then get into SQL Server 2008 and create the tables ? right ? :)


    Always wanting to Learn.
    Monday, February 14, 2011 7:19 PM
  • Yes, varbinary(max) only uses as much space as you stick into it. To get a fixed size, use something like binary(8000).
    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty
    Monday, February 14, 2011 9:40 PM
  • Thanks Rick

    About my question regarding converting from string to all other major data types. Is it possible ?

    Sorry to be going on about this, but I would be devastated if after doing days of work on the Model (database side) I find out it isn't possible.

    EDIT: I have slightly changed the ERD. Can you please check it.

    Thank You.


    Always wanting to Learn.
    Monday, February 14, 2011 10:09 PM
  • Now realise your question about data types only applies to the ATTRIBUTE table.

    Given this design, your only choice is varchar for the attribute value column really.

    Is the purpose of this to reflect that every product has a different set of attributes, and indeed can have more than one of the same attribute?

    If you can, it might be better to divide your products into types, with each type having a consistent set of attributes.


    Twitter
    Tuesday, February 15, 2011 8:24 AM
  • Now realise your question about data types only applies to the ATTRIBUTE table.

    Yep, I fully realize this.

    Given this design, your only choice is varchar for the attribute value column really.

    Yep, which is what I currently have.

    Is the purpose of this to reflect that every product has a different set of attributes, and indeed can have more than one of the same attribute?

    Yep, that is EXACTLY what the purpose is. Though, not more than one of the same attribute. But certainly each product would have one or more different attribute.

    If you can, it might be better to divide your products into types, with each type having a consistent set of attributes.

    I was hoping more " I'm sure it will be better to divide your ..etc " hehe

    "It Might" scares me a bit, cause I might spend weeks on this, then find out it doesn't work. Can you please put together a VERY quick sketch of what you mean ? I would greatly appreciate it.

    Here is a screenshot of the categories needed. Each Product in different categories have different attributes (depending on category).

    Thank You.


    Always wanting to Learn.
    Tuesday, February 15, 2011 9:06 AM