Pattern design to be easy queried.

D

Dawn

Table Cust, has the following fields:
CustID(PK), Gender,[ Education level], Occupation,KeyCustomer(Value:Y/N)
[ Income Level],GenderCode,EduCode,OccupationCode, IncomeCode,

There is a Code Dictionary:
Field Value Code
Gender M 1
Gender F 2
Gender Unknown 3
Education level Primary 4
Education level Secondary 5
Education level college 6
Education level Graduate 7
Education level Post Graduate 8
Occupation 1 9
Occupation 2 10
Occupation 3 11
Occupation 4 12
Income Level 1 13
Income Level 2 14
Income Level 3 15
Income Level 4 16

Field Gender value: M/F/Unknown, Education level value ditto, Occupation
value ditto,Income level value ditto,
GenderCode value:1-3; EduCode value:4-8, OccupationCode & IncomeCode value
9-16 respective.

In Fact I want to generate an excel sheet Like following:
Customer Number
Gender:M
F
Unknown
Education:primary
……
Income:1
…..
Income:4

In fact the row and column are much more.
To do this sheet, I can write separate queries on
Gender,Education,Occupation,Income, but that will write many queries.
I’ve thought of one way, to generate a new table, with only two fields,
CustID& Code, CustID is no longer a PK field, Code values from 1 to 16, and
in this table every CustID will appear 4 times, as for gender,
edu,occupation,income.
Then inner join this table with the previous table.

My question is how to realize this sheet with the previous table. Can any
MVP give a simple way?
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top