By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,244 Members | 1,772 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,244 IT Pros & Developers. It's quick & easy.

Needs Help in Making Database

P: n/a
Please see the detail of tables with fields in SQL server 2000.

·Table Student .Table Good Qualities
( It is a list of Students) (It is a list of Good Qualities)
1- Student Id (P.Key) 1- Serial No. (P. Key)
2- Student Name 2- Good Quality

· Table Bad Qualities .Table Future Plans
(It is a list of Bad Qualities) (It is a list of Plans)
1- Serial No. (P. Key) 1- Serial No. (P. Key)
2- Bad Quality 2- Future Plans

·Table-Personality
1- Student Name/ID
2- Good Qualities
3- Bad Qualities
4- Future Plans

Data will store in Personality table like that

Student ID G.Q.No B.Q.No F.P.No
101 3 2 1
101 4 5 NUll
101 8 Null Null
202 4 8 9
202 Null 3 1

Required Result Now I have to generate a report of One student and
sometimes of many students comprising of their Name, G.qualities, Bad
Qualities and Future Plan. To generate report User input will be only
student id.

I Need help in making relationship of these tables as well as in
Making a Query. Any suggestion to get the required result. Specially
please look at the Personality Table because I do not understand
Primary key for it. Should I just include the Serial No. as Primary
key.
Please make necessary changes to get the required result.

I shall be really thankful to you for your kind favor.
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi

It is better to post the DDL (Create table statements) for your tables
rather than a pseudo-schema

You should have student id in the personality table (as I assume this should
be static and names can change!) if Student -> Personality is a one to one
relationship, student id can be made the primary key of the Personality
Table. Your personality table should have foreign keys for Serial No in each
of the other tables.

John
"Waqas" <wa********@hotmail.com> wrote in message
news:d1**************************@posting.google.c om...
Please see the detail of tables with fields in SQL server 2000.

·Table Student .Table Good Qualities
( It is a list of Students) (It is a list of Good Qualities)
1- Student Id (P.Key) 1- Serial No. (P. Key)
2- Student Name 2- Good Quality

· Table Bad Qualities .Table Future Plans
(It is a list of Bad Qualities) (It is a list of Plans)
1- Serial No. (P. Key) 1- Serial No. (P. Key)
2- Bad Quality 2- Future Plans

·Table-Personality
1- Student Name/ID
2- Good Qualities
3- Bad Qualities
4- Future Plans

Data will store in Personality table like that

Student ID G.Q.No B.Q.No F.P.No
101 3 2 1
101 4 5 NUll
101 8 Null Null
202 4 8 9
202 Null 3 1

Required Result Now I have to generate a report of One student and
sometimes of many students comprising of their Name, G.qualities, Bad
Qualities and Future Plan. To generate report User input will be only
student id.

I Need help in making relationship of these tables as well as in
Making a Query. Any suggestion to get the required result. Specially
please look at the Personality Table because I do not understand
Primary key for it. Should I just include the Serial No. as Primary
key.
Please make necessary changes to get the required result.

I shall be really thankful to you for your kind favor.

Jul 20 '05 #2

P: n/a
On 19 Jun 2004 13:03:17 -0700, Waqas wrote:

(snip)
I Need help in making relationship of these tables as well as in
Making a Query. Any suggestion to get the required result. Specially
please look at the Personality Table because I do not understand
Primary key for it. Should I just include the Serial No. as Primary
key.


Hi Waqas,

I can understand that you don't understand this table. The design is
wrong. Each table has to have a primary key. No columns in the primary key
may allow NULL values. In this design, only the StudentID column disallows
NULLS, and this column by itself clearly is not a primary key. The design
error is that multiple independent n:m relations are stuffed together in
one table.

As I have a strong hunch that this is a homework assignment, I'll stop
here and leave it up to you to use my hints and figure out the correct
model. Apologies if I'm incorrect about this being homework.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 20 '05 #3

P: n/a
John Bell (jb************@hotmail.com) writes:
It is better to post the DDL (Create table statements) for your tables
rather than a pseudo-schema


My guess is that the guy does not have the DDL yet. This looks like
a class assignment to me. And those we are usually not very helpful
with...

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.