Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hello, I'm trying to code a periodic table program like this one...
<img src="http://8pic.ir/images/60z8s53jgc512x0bxctl_thumb.png" border="0" alt="آپلود عکس" title="آپلود عکس" />

How do I create the tables of database for it?
Have I to create a table for each element?
Posted
Updated 25-Jul-14 16:23pm
v3
Comments
Sergey Alexandrovich Kryukov 26-Jul-14 1:42am    
This question is way too vague. Just think about it: what should we do to help you? Design a database and then write a whole big article about all the detail? Hardly. It could be more productive if you explain some particular problems you face with this project. This is the case where the database should be pretty easy to design.
—SA
Ali Ebrahimi B 26-Jul-14 21:39pm    
I'm facing this problem and have stopped project for about 3 weeks. The real problem is that if I store the properties of elements in columns in tables of database and then fill the DataTable in c# with SqlDataAdapter, the properties are loaded in columns, not in rows like the snapshot.
I've tried lots of ways to solve the problem and the most successful was that to Design the DataTable and fill it manually and load the value of property from database. But I can't write a query that returns just the value of a specific cell in a column in string.
It was the whole problem I described and if you haven't got the problem, I'm ready to answer your questions.
I'm really waiting for your solutions because it's really a long time I stopped the project.
Sergey Alexandrovich Kryukov 26-Jul-14 22:18pm    
You just need to learn on the relational model. A row is a single record, and a column is a part of database schema. Of course different attributes of a single record should appear in different columns. How else? You problem is not clear, I would assume it is only the result of your misunderstanding of the basic concepts. I don't know what to ask about, because your way of thinking remains a mystery to me... :-) The database design for suck kind of problem is really, really simple; I just don't see what are you missing. Maybe just general understanding of how relational model works.
—SA

1 solution

Create one table for storing all the parameters given in this link and add 1 extra field i.e Isotopes which can have values Yes or No. Create Second Table for storing isotopes and join both table on Atomic numbar.
 
Share this answer
 
Comments
Ali Ebrahimi B 26-Jul-14 21:41pm    
Thank you but it isn't solving the problem I described.
Sergey Alexandrovich Kryukov 26-Jul-14 22:13pm    
Please look at the time. You provided some explanation of your problems two minutes after this answer post. Be logical. You could at least refer to your information and explain what do you think is missing. From your original post, it would be too hard to add a lot more to this advice.
—SA
Sergey Alexandrovich Kryukov 26-Jul-14 22:22pm    
More exactly, the table of Isotopes should have a foreign key pointing to the record in the table of elements. The primary key in the table of elements could be atomic number or it can be the standard symbol of the element. Anything unique.

And it's not clear why "yes/no". And why 1 extra field. It's detail table records point to master table, not the other way around.

—SA
Ali Ebrahimi B 26-Jul-14 22:33pm    
Forgot the Isotopes. The main problem is General Data.
My problem is loading the parameters and values in rows instead of columns and I really thank you if you help me if you understand the problem.
Sergey Alexandrovich Kryukov 26-Jul-14 22:49pm    
I guess this problem is just your fantasy. And this is not how it works. First, you help us understand your problem, even if it exists, and then we try to help you.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900