Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tables

Status
Not open for further replies.

skia

Programmer
Feb 1, 2002
9
0
0
GR
How can i know which field i must set to each table?

What is the criteria for separating fields into different tables? Intel Inside, Idiot Outside!
 
I understand that you are asking about the basics of data base design, right ?

Well, this question can not be answered in one or two sentences, the required design of your data base fully depends on what information it will hold, and on what you want to do with this information.

If you wanted, for example, to create a data base with all the phone numbers and addresses of people in Greece, you would need two tables.

Table1 would hold the Name|Surname|StreetName|HouseNumber|PostCode|PhoneNumber ,
Table2 would hold PostCode|CityName

If you "connected" both tables using the PostCode field you could display all information from each record from table1 PLUS the CityName from table2.

If you add a field SHOW in table1, which can hold only YES or NO, you could design a statement that shows only the records marked SHOW = YES, or those marked NO. You would do this to avoid being presented with all addresses which you do not wish to see (because marked NO means "not my friend any more" for example).

As you see, this is a very complex issue.
Maybe you could specify your question to what exactly you want to achieve to bring in the most helpful answers .

Regards,
Bernd
 
Thank you very much you are right!
I'am a rookie in this, so forgive me!

I want to hold Name,Surname,Street,Phone,remark for each of my friends.

How many tables must i use? One or Two and why?
Which field in every table?

p.s. Do you know of a good on-line book for mysql?

I use MySql Clients and Servers 3.4.x

Do you have in mind a better suggestion for mysql or another sql? Whick SQL is the best out there?

Thank you. Intel Inside, Idiot Outside!
 
Hi skia,

if you just want to store information like

Name|Surname|City|Street|PhoneNumber|Remark

you will probably need one single table only as the information stored in each record is specific.

You could, if you wanted to make this really complex, create a second table of all the cities in Greece (which would then be like in my first reply), and maybe another table with all the streets in each city in Greece.

Your names entry of "Miller , Joe, 1000, 9999, 0123-4567" would then link to the cities table and find
"1000 | ATHENS", and in the streets table it would link to " 1000 | 9999 |Main Street [in Athens]".

At least this is how it works.
But I believe that for your purposes a single table will do. You will not even have to install a relational data base system for that, programs like MS-EXCEL can handle this just fine.

As for hints to decent books on data base systems, just use an internet search agent to find you millions of good sources (I am using SQL on an IBM AS/400 system, thus NOT any MySQL or MS-SQLServer or things ...) .

Best regards,
Bernd

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top