Reputation
7,270
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
1 9 23
Newest
 Explainer
Impact
~172k people reached

1d
comment Snooping-safe Vote tables
Ranvijay, I agree with the direction you're suggesting. If you expand your answer to give more detail, perhaps an example and discuss how this gives the protection the original poster is asking and also what potential shortcomings your answer might have, then you will get more up-votes and soon you will build enough reputation to be able to participate in the site in more ways.
Jul
2
answered How to decide when is use ERD or UML for data modeling?
Jul
1
comment table structure for events
Google for intersection table and many-to-many relationship.
Jun
27
comment Is it better to use an ID (int) or a Name (varchar) as PK for a table?
I would suggest that using a "name" (any human familiar string) for a primary key is really only safe if the set of values is controlled by an outside standards body that will naturally manage change to be infrequent, such as ISO country or currency codes. In other cases changes and even key conflicts are likely. I know there are three different Joel Browns in my neighbourhood, for example.
Jun
25
comment Many tables v/s one table with different entities types
@hagrawal Thousands of records are not very many records to a relational database management system. Performance is not going to be an issue with data of this size. The only way to tell for sure whether one table or many tables is more efficient is to try each approach under heavy production loads and then measure the resource usage. I would guess that such careful measurement is not worthwhile given the very likely small differences in performance between the two approaches.
Jun
25
comment Many tables v/s one table with different entities types
@hagrawal Writing your code to select and unpack a list of translations based on OR or IN clauses is not necessarily going to be demonstrably more efficient than using a single, simpler query repeatedly. If there is a large latency between your web server and your database server, then perhaps round trips would be an issue, but otherwise my personal preference would always be for simpler code as it is more maintainable and therefore more economical in the long run.
Jun
25
comment Multiple rows v/s multiple columns
@hagrawal - Please beware: Using dynamic SQL is precisely when you need to be concerned about SQL injection. It all depends on exactly how you do it. You need to make sure anything that comes from the user, including things spoofed by malicious browser emulation are escaped to avoid SQL injection. Parameterized SQL queries are much less prone than dynamic SQL to this type of attack.
Jun
25
answered Many tables v/s one table with different entities types
Jun
25
answered Multiple rows v/s multiple columns
Jun
24
comment Multiple rows v/s multiple columns
Agreed (+1) but you should state your reasons for preferring this approach.
Jun
10
answered Can I Show Multiple “WHERE” Filtered Results In A Single Query/Output Table?
Jun
6
revised Best practice for entry position indicators
Grammar!
May
29
revised Trigger Performance - 1 or 2 Triggers?
Spelling and detail in the question title
May
24
comment Does schema normalization enhances query efficiency
@FokwaBest - There is no one factor that has 100% influence over query efficiency. If your schema doesn't permit an efficient query because it is badly structured, then you obviously won't have one. Lack of normalization is not the only (or necessarily the most important) way in which your schema could inhibit query efficiency. Inappropriate indexing is more important, for example. If your schema isn't an obstacle but you write your query in an inefficient way then of course your query will be inefficient. What you have, how you structure it and how you access it all come into play.
May
23
answered Does schema normalization enhances query efficiency
May
19
comment How should I model an “either/or” relationship?
@DanielSerodio - I used Visio with smart shapes I built myself based on the James Martin ERD notation. The shapes use a custom line texture to give them an informal appearance, which I find helpful in reminding people when a diagram is a "sketch" or draft design.
May
9
answered How to enforce that one row in a parent table MUST be associated with at least a row in a child table
May
5
comment T-SQL insert value based on identity column
@Jyrkka - I mean a situation in which a relation is not in second normal form. In your case specifically, a customer is uniquely identified by the meaningless sequence number. This number is a candidate key. Adding a customer type prefix to this number does not make it more unique.
May
1
comment T-SQL insert value based on identity column
@Jyrkka - I'm not offended, so don't worry on that account. My point is that using an identifier prefix to encode something that is an independent fact about the entity is considered bad design as it violates the spirit of database normalization rules insofar as it creates a situation in which non-key attributes are not dependent on the whole key. Perhaps pseudo-random is a less apt term than meaningless. An IDENTITY value (or Sequence value) is not related semantically to other (non-key) attributes of the entity. In that sense it may as well be a random number, rather than sequential.
Apr
28
comment T-SQL insert value based on identity column
It doesn't make much sense to me to embed a customer type code in a pseudo-randomly generated customer identifier. The conventional wisdom is not to build meaning into identifiers. As rules of thumb go that is a good one in my experience. However, your mileage may vary.