Data Representation

  • cancer10
  • Proficient
  • Proficient
  • cancer10
  • Posts: 268

Post 3+ Months Ago

Hello People,


I designed this application keeping in mind the normalization technique. Let me give you a brief overview of my application and how have I designed it.

My App is a form/webpage where in we save details about all countries. The structure of the DB is as follows:

Code: [ Select ]
+++++++++++++++++++++++++++++
Table Name: tbl_country

ID [Autoincreament]
Country_Name [varchar]
Currency [varchar]
Country_code [int]

+++++++++++++++++++++++++++++
  1. +++++++++++++++++++++++++++++
  2. Table Name: tbl_country
  3. ID [Autoincreament]
  4. Country_Name [varchar]
  5. Currency [varchar]
  6. Country_code [int]
  7. +++++++++++++++++++++++++++++


I also have a second table which would keep records of employees of that particular country. The DB structure is as follows:

Code: [ Select ]
+++++++++++++++++++++++++++++

Table Name: tbl_employees

ID [Autoincreament]
country_ID [int]
Employee_name [varchar]
Employee_telephone [varchar]

+++++++++++++++++++++++++++++
  1. +++++++++++++++++++++++++++++
  2. Table Name: tbl_employees
  3. ID [Autoincreament]
  4. country_ID [int]
  5. Employee_name [varchar]
  6. Employee_telephone [varchar]
  7. +++++++++++++++++++++++++++++


The tbl_employees.country_ID column will contain the value of the tbl_country.ID column.


Assuming there are 200 countries in the tbl_country table and each country has 5 employees. What is the best way to display the report in a tabular format. So that it lists all countries row by row and each row will display employees of that particular country in different columns.


Also, what would the query for it be?


I am using MySQL 5 with PHP 5

Thanx a ton in advance for any help.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

well the query would be something like:
Code: [ Select ]
SELECT * FROM tbl_employees LEFT JOIN tbl_countries ON tbl_employees.country_ID = tbl_countries.Country_code

go into phpMyAdmin or whatever you are using and see what the output of this query returns ...
  • cancer10
  • Proficient
  • Proficient
  • cancer10
  • Posts: 268

Post 3+ Months Ago

thanx man

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 82 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.