Specification & Generalisation in ERD - sql

I would appreciate if someone could clarify this confusion for me.I'm struggling to identified when to use each of them.
Mandatory, OR/Mandatory, AND
Optional, OR/Optional, AND
Thank you

Related

Attempt to make ER diagram of Reddit

I'm trying to design an ER diagram of Reddit as part of a project.
I need help mainly for the post and comments.
The way I see it, posts and comments have several attributes and relation in common, so I tried to create a parent entity called Thread as an EER diagram. A comment links to another comment or to a post. Hence the relation of 'points to' is connected to the Thread entity.
Other relations that are common to comment and post are relation with Report, relation with Award. etc
Another option would be to separate Post and Comment and get rid of Thread all together and make relations individually.
My doubt is that, is this correct? or is this the best way we could do it?
Updated Diagram:
It look like that in your diagram nothing rely a Comment to a Post. I mean nothing add the relation that : Many Comment have One Post, One Post have Many Comment. Because I suppose that a Comment only exist on a Post. If the Post get deleted, all Comment get deleted too. Maybe you should rely them with this ManyToOne, OneToMany relation.
I think that the Inheritance you are using doesn't specify the relation which I mention above. You actually using inheritance more or less just as a provider of common properties. I'm not sure this is a good thing, because actually Post will inherit of the relation of points to.
By using this inheritance you say that :
One Post, or one Comment is related to OneToMany Comment (<== you should use Zero or Many);
Maybe to keep thing simple you should do something like :
Post ZeroToMany Comment (Zero or many)
Comment OneToOne Post (one and only one)
Comment ZeroToMany Comment (Self reference)
Comment ZeroToMany Comment (Self reference)
I try to illustrate what I'm thinking about :
Also, you need this VOTE entity to keep track of which user have upvote or downvote a contribution.
I'd caution that I don't really know Reddit so I relied on the stack overflow post and comment system.

Postgres - DB Design & Spring-Data-JPA query related suggestion required

Hello Friends,
I have a kind of requirement like, Student & Question are entities.
Both Entity are in many-to-many relation.
I would like to represent my idea is something likewise(refer below screen-shot. please correct me if any improvement is possible).
I would like to know from you guys is that,
1) is the above mentioned DB-design is good ? is there any improvement
then let me know.
And second one is related to query(JPQL),
2) it's most important, in spring-data-jpa, how would I implement in
such a way so that, even though user has not answered question then
also, those question needs to reflect under user-profile page that
this question is still not answered. Refer below screen-shot about
an expectation of this(second one) question.
Any help would be really appreciable!!

how to modify this erd diagram?

I'm sorry i couldn't form the question to be clear enough to describe the problem but I'm not a pro at this.
I'd like to ask
-how should I make this ERD format in the correct way ?
scenario is the salesman chooses an expert depending on what the expert days are and months will be available on + the kind of job like :part-time or full time ?
any ideas to modify the erd diagram ? maybe a new entity relationship ? i'm not sure
problem is underlined in the first picture please check it out>>
how can i solve this erd diagram , check this picture of erd diagram
class diagram

Can anyone explain me 1NF, 2NF, 3NF, BCNF rules with a proper example?

This is a common interview question. I faced one interview where the interviewer gave me one table and asked me tell him which normal form the table is in? If it's in ##NF, then normalize it to the next NF?
I'm always get confused between these normal forms of database.
Can anyone explain to me these normal forms with a proper example of how each NF is modeled into table so it will help in my next interview?
Boyce Codd Normal Form is really the most important and also the easiest to explain: Every non-trivial determinant is a superkey (just remember "arrows out of superkeys"). The lesser normal forms are only worth mentioning because BCNF is not dependency-preserving in a few cases.
Examples of BCNF and 5NF by Hugh Darwen:
Database Design Issues: Part I
Database Design Issues: Part II
For more mathematical definitions (Abiteboul et al):
Foundations of Databases: The Logical Level

Modelica - how to implement a constructor for a record

What is the best way to implement a constructor for a record? It seems like a function should be able to return a record object in the instantiation of the record in some later model higher up the tree, but I can't get that to work. For now I just use a bunch of parameters at the top of the record that populate the variables stored in the record, but it seems like that will only work in simple cases.
Can anyone shed a little light? Perhaps I shouldn't be using a record but a model. Also does anyone know how the PDE functionality is coming? The book only says that it is coming, but I have seen some other things around.
I don't seem to have the clout to add tags (which makes sense, since my "reputation" is lower than yours) so sorry about that. I thought I had actually added one at one point, but perhaps I am mistaken.
I think you need to be clear what you mean by constructor since it has a very specific meaning in Modelica. If I understand your question correctly, it sounds like what you want to do is create an instance of a record that has some fields that are specified in the constructor arguments and from those arguments a bunch of other fields in the record are computed. Is that correct?
If so, there is a mechanism to do this. You mention "the book" but it isn't clear which one you mean. If it is mine, it definitely has no mention of these so called "record constructors" because it is too old. I do not know if Peter Fritzson's book mentions them either. However, they do exist and are documented in Section 12.6 of the Modelica 3.2 specification.
As for PDEs, there has been work into this kind of thing but nothing has really been done within the design group on this topic. I would add that if you want to solve either elliptical or parabolic PDEs on regular grids, this isn't too hard even with the current language. The only real drawback is that most tools probably don't handle sparsity very efficiently. Irregular grids would also be possible, but then you get into complicated basis functions. Finally, hyperbolic PDEs are, in my opinion, quite tricky (in any environment) due to the implicit physical constraints between time and space which are difficult to express (i.e. the CFL condition).
I hope that answers your questions so far.
I can only comment on your question regarding the book of Peter Fritzson. He confirmed that he's working on an update and he hopes to get it ready 'in the course of 2011'.
Original post here:
http://openmodelica.org/index.php/forum/topic?id=50
And thanks for initiating the modelica tag, I might be useful in the near future for me too... :-)
regards,
Roel