473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Select Field Based on user input

I'm bulding a database of students and their yearly performances. I
have a student table with all of their permanent information, and a
academic performance table that has different fields representing their
academic performance for the year. Within the academic performance
table, I have a field for Fall Semester GPA, and Spring Semester GPA.

I'd like to create a query that outputs all academic information for
students in a particular semester. To do that, I'd like to create a
dynamic SQL Query that takes in an indicator from the user to include
either the fall semester GPA, or the Spring Semester GPA among the
output, but not both. Is this possible?

Jan 10 '07 #1
1 1455
Mi***********@gmail.com wrote:
I'm bulding a database of students and their yearly performances. I
have a student table with all of their permanent information, and a
academic performance table that has different fields representing their
academic performance for the year. Within the academic performance
table, I have a field for Fall Semester GPA, and Spring Semester GPA.

I'd like to create a query that outputs all academic information for
students in a particular semester. To do that, I'd like to create a
dynamic SQL Query that takes in an indicator from the user to include
either the fall semester GPA, or the Spring Semester GPA among the
output, but not both. Is this possible?
Hello,

Your first hurdle is to understand how to correctly model this data in a
relational database.

In your example you have two entities: students, and semesters. Students
are enrolled in many semesters, and semesters have many students enrolled.

This is a classic "many-to-many" relationship. At its simplest this is
best represented in three tables.

Your students table, which is probably OK, should have information about
the students as people. Nothing about their classes, grades or semesters
belongs here.

Here is where you need to rethink your design:

Rather than have one table with one student and many semesters across
the horizontal (a spreadsheet design) you should break this up.

A table of semesters, enumerating semester information only.

A "joining table" that pulls together one student and semester per row.

It is now much easier to query the joining table for a particular
student and semester.

I have attempted to construct a data model of students, classes,
courses, etc. It is somewhat wider than your scenario but if you would
like to see how these many-to-many relationships play off each other,
feel free to view this:

http://vfdrake.home.comcast.net/files/students.pdf
--
Smartin
Jan 11 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Randell D. | last post by:
Folks, Perhaps someone can figure this out - this is 'the process of my script' I have a form whereby I can add multiple contacts to a single address. There is only one...
3
by: TekWiz | last post by:
I've got a system that automatically generates a form. I have it set up so that the backend will return to the inital form page with an error object in sessions data (assuming the backend detected...
0
by: Bharat Suneja | last post by:
Hi All, I'm running into issues with passing the distinguishedName of a user as a hidden form field in a form from one page to the result page. Page 1: User enters user name in a form field ...
19
by: Neal | last post by:
I can have a visitor choose a subject line for an email. <div><label for="subject">Subject:</label><br /> <select class="form" id="subject" name="subject"> <option value="one">One</option>...
5
by: Dave Brydon | last post by:
I'm checking for required fields, and using the code below, which I normally have no difficulties with; however, as a twist I decided to return the focus back to the specific field(s) in question...
0
by: DutchD | last post by:
Good day all, Access novice here and have been stuck for a few days on what would take me two seconds in vba, but isnt that always the pain, now I want it done this way! I have a table (Input...
4
by: Garry Jones | last post by:
I want to Select a field based upon the number the user keys in I want to retrieve another field from the same record This is not working. How do I do it? The tricky bit seems to me to be...
17
vikas251074
by: vikas251074 | last post by:
I have create form as below - <table> <tr> <td align="right">VLAN Name : </td> <td> <select name="vlan_name" style="width:150px "> <% ...
2
by: csolomon | last post by:
Hello: I am creating a form that will calculate a value based on the value selected from a case statement in a function. The function I created is called GetYield and accepts 3 arguments. I...
45
by: dizzydangler | last post by:
Hi, I'm new to access (2007, running on XP), but I've gotten some great help from this site on my project so far. However, the more I know, the more complex the problems seem to become.... I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.