-4

I have found the following E-R diagram in page 18 of Database System Concept book.

enter image description here

You will find more E-R diagram in that book. How can I draw similar design and colored E-R diagram?
If you want MWE you can see marmot's solution because I don't know how to do this before he answered.

[You can recommend better color combination]

  • Please add a minimal working example of what you have tried so far. This example could be useful: tex.stackexchange.com/questions/366486/… – CarLaTeX Mar 26 '18 at 5:40
  • @CarLaTeX As I don't know how to make this so I couldn't add MWE. Sorry. – alhelal Mar 26 '18 at 5:59
  • (i) first select package for drawing with which you are familiar; (ii) search through site for similar diagrams (here are plenty of them); (iii) if you like to have showed image, why you not include it your document by \includegraphics[...]{...}*? – Zarko Mar 26 '18 at 6:20
  • @Zarko I am familar with tikz-uml. I have done some class diagram using pgf-umlcd. I willn't include this image. I have to make new schema diagram and E-R diagram for my project. – alhelal Mar 26 '18 at 6:32
  • than i suggest you use pure tikz. for nodes use shape rectangle split from tikz library shapes.multipart. for start see texample.net, maybe you will find something similar. to receive answer you should firs show, what you try so far. – Zarko Mar 26 '18 at 6:40
1

All these diagrams are basic, and @Zarko already kindly told you the keywords you might want to look up if you are not already familiar with them. Even though the larger diagram can be straightforwardly be drawn, I am not in the mood to type in the text of your screen shot. So here comes a realization of the upper picture.

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{positioning,shapes.multipart,shapes}
\begin{document}
\tikzset{basic/.style={
        draw,
        rectangle split,
        rectangle split parts=2,
        rectangle split part fill={blue!20,white},
        minimum width=2.5cm,
        text width=2cm,
        align=left,
        font=\itshape
    },
    Diamond/.style={ diamond, 
                        draw, 
                        shape aspect=2, 
                        inner sep = 2pt,
                        text centered,
                        fill=blue!10!white,
                        font=\itshape
                      }}
\begin{tikzpicture}
\node[basic] (instructor) {instructor
\nodepart{second}
\underline{ID}\\
name\\
salary};
\node[basic,right=5cm of instructor] (department) {department
\nodepart{second}
\underline{dept\_name}\\
building\\
budget};
\draw (instructor) -- (department) node[midway,Diamond]{member};
\end{tikzpicture}
\end{document}

enter image description here

  • ! Package PGF Math Error: Unknown function item' (in 'item.south'). See the PGF Math package documentation for explanation. Type H <return> for immediate help. ... l.49 email}; ?` when I use this code. see my code paste.ubuntu.com/p/qv8yRVHFcR output pasteboard.co/HdROdKu.png – alhelal Mar 27 '18 at 17:20
  • The code runs through without a problem here. Note also that the code does neither contain item nor south. One possibility is that you are compiling a different code, another one is that there is something wrong with your TeX installation (perhaps it is outdated). – user121799 Mar 27 '18 at 17:22
  • see my linked code. There also a node named item. And mainly I want to do something like tex.stackexchange.com/a/396436/128718 – alhelal Mar 27 '18 at 17:30
  • Your E-R diagram solution helps me lot. I am starting to make my works using your solution. But, I am stuck in schema diagram. If you would make the schema diagram only for instructor and department(you have already written, just need modification) then I use that syntax to start. Thank you. – alhelal Mar 27 '18 at 17:37
  • @alhelal OK, you were mixing two codes and got an error, right? If you cannot resolve it on your own, post the code as a question, and people will look at it. Then at least you have an MWE, and people won't downvote your question. (BTW, I did not downvote your questions.) – user121799 Mar 27 '18 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.