How to map ER Diagram of user asking questions and answering scenario? - database

How to draw the ER diagram of below mentioned scenario?
Scenario: Users can asks questions according to subjects they have enrolled, and as well as answer to those questions. So basically Users can ask questions belongs to subjects and Users can answer to those asked questions.
In my diagram I have 3 entities, those are User and Question, and Subject. And Answer will be a derived attribute of the relationship between User and Question entities. And Question belong to a Subject.
My question is can Question be introduced as an Entity to the ER diagram or not?
When thinking about the definition of the Entity, I feel Question cannot be introduced as an Entity to the ER diagram.
If then, how Question can be introduced to the ER Diagram?
Is below er diagram is correct or wrong?

I don't know how you structured your database. You can use loop in this case. Group of users are the one who asks as well as answers question. It is a m:n relationship. You can add subject as descriptive attribute. It is hard to answer without knowing the entire database structure. I hope it can give you some ideas.

Related

Modeling Tool for NOSQL Databases [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I know that most of the time NOSQL databses are schema-less or at least have a flexible database schema.
However, the basic schema needs to be modeled beforehand and may evolve later. So,in this case, is there a modeling tool/language for NOSQL databases?
Like UML for RDB and Visual Paradigm (UML modeling tool). I found that for "Graph Databases", we can use "Property Graph Model" but I am working on "BigColumn Databases" and "Document-base Databases".
Thank you.
NoSQL databases approach modelling from a different point of view generally. NoSQL modelling usually begins with asking questions on how the data in the database is going to be queried, so the main modelling is 'what are the list of questions that I want to ask of my database', whereas with SQL databases, modelling usually is a function of what data you have, that is, what answers I have already. This mental exercise of finding out what questions one would like to ask of the NoSQL database serve to define the entities and the relationship amongst those entities.
Once you have a list of questions, you then need to design a model that will answer those questions via the NoSQL database. To model it, I typically use Creately which is an online tool for visually representing models of various kinds.
Another method could be to represent your NoSQL model in JSON format and then use the wonderful D3.js javascript library to create a data-driven document. See this website for more details and the templates available to visually represent your model.
Hope it helps.
KDM is one solution you can think for NoSQL database Cassandra. This tool starts from conceptual modelling till physical modelling. May be you can have look at this. This is available to use free online.

Is it a good design with all-in-one tables? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I have a social networking system, and there are topics, tasks, questions, links, documents, videos and so on. I plan to put all of them to one table named posts, and there is one column name kind to identify. Is it a good design ? why ?
BTW:
1、I am using postgresql
2、I just think there are many repeated columns between them , for example: the title, the content, the created_at and the author
From your description it seems like all these domain objects have something in common. Otherwise you wouldn't even think about storing them in one table. Accidently or not what you have described is one of the techniques of mapping inheritance to relational model, called single table. The link above describes in detail other techniques and what are their pros and cons.
You can't index columns for which you want to perform search on it. Why do you want to put everything in the same table at the first place?
No. It limits these things to all having the same attributes. So if, for example, a "Link" needed a URL field, a topic, a task, a question, etc would all have to have one too.
It is NOT a good design with postgresql. Normalizing data in a relational database is very important.
You should consider using a NoSQL database system such as mongodb.

Tools to visualize a database and understand the datamodel quickly [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have several SQL Server 2005 databases ranging from 20 – 600 tables in an application and no documentation. I am looking for a database diagramming tool that is smart enough to pick tables that seem to be related to one entity (e.g., tables related to Patient, tables related to Orders) or one functionality (e.g., Patient Management, Order Management) and show them separately instead of drawing the entire database.
In the past, I have seen tables related to one piece of functionality represented in one color in the ER diagrams. In a well designed database, perhaps there will be multiple schemas that group tables related to one functionality together. But as all these tables are in one schema, and I want a tool that is smart enough to perhaps suggest which tables should go together under one schema. It won’t be perfect but perhaps it is intelligent enough to examine which tables should go together (for example based on relationships between them or based on which tables seem to be accessed together in the stored procs).
The bottom line is that I want to understand the data-model as quickly as possible. A tool called Schema Spy ( http://schemaspy.sourceforge.net/ ) seem to be headed in the right direction, but I was wondering if anyone knew better/more comprehensive tools.
Thanks.
Have you tried Visio at all? While it does not satisfy everything you asked for it can reverse engineer a database and make very appealing diagrams with a little work.
I have never used it to understand an existing database, but I have used it to explain databases I have created.
You could have a look at wsSqlSrvDoc. It's a nice little tool that works with Sql Server extended properties and creates a MS Word document.
The print-out of all column properties (with foreign key relations) works out of the box. For further descriptions on each field you have to set up extended properties of those columns in Sql Server Management Studio.
The downside however is that it's not free (but quite afordable). And if you just need to create a documentation for a "not work in progress" DB that's more or less finished than it would be enough to use the free trial i'll guess.
This question is related to an older question, Link:A good database modeling tool?
From the answer to this question, e.g. fabFORCE.net dbDesigner might be what you are looking for.

Database for US Universities and Colleges [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Not sure if this is the proper place to post this question, but I've seen questions regarding ISBN databases, so I thought it would be appropriate.
In my website, I intend allow my users to choose between all the US college/universities (community or 4 year institutes). I would then store their selection in a database.
At first I thought about allowing them to input the name themselves, but saw some issues with that. I tried to look for a database of some sort, but all I found were search engines to find a specific university.
I was hoping to find a database can I export to my own database (SQL Server) and have users search my own database.
Has anyone come across this issue and found a reasonable solution?
This is an old question, but I wanted to post the answer for those who find this page.
This should do the trick: http://ope.ed.gov/accreditation/GetDownloadFile.aspx
It's a csv and xls file of all the accredited universities in the US. It's about 22,800 rows and narrowing it uniquely by name brings it down to about 9,000.
Enjoy!
This question was posted in 2011, but luckily data is getting easier to come by!
Department of Education now has an API (also CSV) available to get a variety of data about universities as well as public elementary and high schools.
Their Directory Listing CSV under 'Colleges and Universities' contains about 7,700 rows which matches up pretty well with NCES data (from 2012) putting the number of post-secondary institutions in the US around 7,000.
Disclaimer before you go write academic research with that database: Considering that NCES number is a couple years out of date, it seems reasonable to assume this Dept of Ed listing is reasonably accurate though I havent tested it rigorously
You can combine these two by having a search box with auto complete, if the input query does not match, indicate if they want to add this into database. You can create a table in database to hold all these contributions and they won't get added to the list before you or someone approve it.
googling for 'list of us universities' gives me a lot of hits.
you could have a textbox which allows them to enter the name themselves but offers autocomplete functionality which aids them in inputing a string which is an exact match to one in your database (sort of like how facebook autocompletes the friend search on the top right)
if the user ignores this and specifies an unknown string, you could either add this new string to your database or refuse, saying that they should ask the admin to add it for them and then try again
The most complete resource is the IPEDS, you need to click on download survey, and download the year data you like. I have called them to see if they have an API, but no luck there, so it's all in excel format. bummer....
http://nces.ed.gov/ipeds/datacenter/Default.aspx
Here is the free database of the major worldwide universities:
https://github.com/turalus/openDB
It's 9498 Universities from all over the world.
Their names are translated into 3 languages: English, Russian, Azerbaijani.
3072 of them have logos.
organized by countries
you get complete list from
http://www.webometrics.info/
complete world univerity names and ranks. now just scrap them .

What is your preferred document format for documenting databases [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am in the process of writing an application which, among other functionality, generates MediaWiki documentation of an MSSQL database (objects, tables, table data).
My question is which document formats you prefer, or are required to produce. I have too many ideas to follow, so your answers should set my priorities ;)
(I know there are other documentation-related questions on SO, but they mostly deal with how to generate documentation (I know how to), and do not ask for specific doc types or platforms)
Edit:
Thanks for the comments. Actually I have table relations already, since I parse foreign keys. However full cross-reference may be a bit trickier ;)
However the question was meant to ask for the document types, such as Word, PDF, ODF, whatever. What are your professional requirements or preferences?
Update:
Overview of generated documentation
It sounds like you have already decided on a document format, which is HTML based on MediaWiki markup.
Also you should generate Entity-Relationship Diagrams which are useful additions to database documentation (though ERD's don't tell the whole story either).
Do you mean document organization, i.e. what headings and content should be included in each page?
Here are some suggestions:
Table Structure
Column names, data types, constraints
Meaning and usage of each column
Extra logical constraints in triggers and application code
Indexes defined
Relationships to other tables
Tables dependent on this one
Tables this one depends on
Notes on special or implicit relationships, that have no enforcement through database constraints
Usage of table
Usage in stored procedures
Usage in application code
Usage in views
Who has read and/or write access; SQL privileges of each user or role
There are other questions at StackOverflow that are very close to this one.
"How to document a database" is a very similar question to yours, since it's specifically about wiki documentation solutions.
"What are the best ways to understand an unfamiliar database" may give you some good tips, as you are creating documentation that would help someone in that situation.
"How do you document your database structure?" is related but not as closely, because it's about putting documentation into the metadata itself.
You might want to have a look at what the commerical vendors do regarding this. As Bill said, you certainly need an ER diagram. Commercial products to look at could include Embarcadero ER/Studio, Red-Gate SQL Doc, Power Designer and others.

Resources