• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to retrieve data from relational database

 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have not done database design before and as a first step I designed a flat database schema in a table called test which contains the following columns and I am also enclosing example data

----------------------------------------------------------------|
ID name item1 cost1 item2 cost2 item3 cost3 |
----------------------------------------------------------------|
1 ivy bash1 30 bash1 10 bash3 20
2 joe bash2 18 bash1 8 bash2 20
3 ila bash3 45 bash3 2 bash2 50

And the list goes on.

Basically bash1 represents a directory by name /usr/fig/bash1
bash2 represents a directory by name /usr/fig/bash2
bash3 represents a directory by name /usr/fig/bash3


Since all the information are ina flat scema right now, I have hard coded the directory as below:



But now I want to change the design to relational database. Hence want to have table as follows which contains the bash info as below:

id bashNo directory
-------------------------------
1 bash1 /usr/fig/bash1
2 bash2 /usr/fig/bash2
3 bash3 /usr/fig/bash3


I am bit confused after this. How do I retrive the information from a relational databaase.

Because if I see bash1 in the 1st table I want to fetch the directory path from the 2nd table. How do I modify my tables and hence my designing is perfect relational database.

Thanks in advance.

[ July 28, 2008: Message edited by: Gopu Akraju ]
[ July 28, 2008: Message edited by: Gopu Akraju ]
 
Paul Clapham
Sheriff
Pie
Posts: 20735
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's called a "join". I won't go into more detail than that, because learning database design from nothing by asking questions on a forum isn't the best way to learn things. Hopefully it gives you the right word to look up in the index of a book, though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic