How can I represent this idea to the database design? [closed] - sql

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am new to database design, I am trying to build a database of shopping system.
Assume we have a Customer table and a Staff table.
The requirement is:
To allow part of the customers to have privilege of "Item return & refund".
To allow part of the staff to have the authority to process the refund.
My idea is to simply add a column with a Boolean value to "Flag" which customer or which staff has the authority or not?
Is that correct to solve this problem? Any potential problem?

This would be correct for a simplistic design. However, if you want to be able to expand on your website or if your needs grow over time, you may need to allow for more detailed permissions. A user_permissions table and an employee_permission table would be desirable in that case.

Related

only one record sql [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
When I have for example only one record for administrators (only one administrator) with id and password, is it necessary to create a table administrator or not? Why?
There's nothing inherently wrong with a one record table. It's a function of your design. For example, an administrator is not a type of user so you wouldn't stick an administrator in the user's table. But that's a design decision.

account transaction procedure in database? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
i am creating db design for supermarket so now i need to normalize account transaction in customer and dealer .
I like to know about the transaction procedure in super market or Departmental stores for My database design.
If anyone know about whats the link between customer and dealer in a supermarket.
Let me know.
Thanks in advance...
I am not sure about your question. But I think this is what you need to read.
http://www.versant.com/products/fast-objects
Just learn some basic stuff. This may be helpful

Show data from multiple tables by date and time [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have these tables: Idea and poll (and others) which are types of what can a member post within a community. I need to show them all in the "Activity stream" ordered by time and date, so a member can see in his "Activity stream" all what others have posted whatever is the type. I've looked around and have found to use the UNION, however they said this way is too slow. I thought to create another table named posts that contains the ID of the post and its time and date, updated in each new post. But either this way costs me a new table. What do you think is the best way? Any other suggestion will be appreciated.
Yes it is, like "Tom asked a question:__ in:__ few minutes a go"
So you need a user name, an action, a timestamp and a hidden id.
Well performance-wise a separate table is better (you avoid unions and maybe joins if it's not necessary to be mormalized), but you have the extra storage (is this an issue?) and the overhead of inserting new records to this table (tiny). Be aware for the usage of a switch to get the details of each activity from its origin table.
Bottom line everything depends on the data volume and the traffic.

RoR - How To Count & Display Comments [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm looking to have a count of the number of comments left under an article and display it on the index page beside that particular article - like the example here in red circles. Any suggestions as to how I might do this?
The picture is an example of what I'm trying to do, its not my site.
This sounds like a good candidate for Rails.cache. Every time you create a new comment simply increment that cache counter using the post id.
If the cache entry does not exist, do a simple article.comments.count (depends on your domain model of course) query and re-cache it.
Storing it in a cache is one idea, yes.
But storing it in a counter_cache column is probably a better idea. That way even if your server was restarted somehow you wouldn't loose the cached values. See http://guides.rubyonrails.org/association_basics.html, section 4.1.2.4.

How to do Normalization? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Hi i am new to this concept and i need your suggestion. i have an excel spreadsheet having about 35 columns and i have to create tables out of it. i have to draw an ER diagram but i dont know which should be the main table having foreign keys of all other tables or is there going to be one main table or multiple main tables?
Normalization is a database concept - it is all about removing redundancies from your data.
There are several different normalization forms, each building on top of the previous.
First normal form - each column in a table should only hold one value, so things like a comma separated list is a no no.
To be honest, the subject matter can get very complex - see this article on how to apply normalization to a table.