That Time the Parens “Almost” Got Me

As a developer, there are days when you pat yourself on the back for the cool, innovative code you wrote, and smile at how clever you are.

Then there are times when you wonder how you can walk and chew gum at the same time. I had one of those “Duh!” moments yesterday.

I am working on a project for our admissions office. They used to get boxes and boxes of paper Advanced Placement(AP) test scores from high school students who are considering applying to Temple. AP tests are exams that high school students can take, usually in a subject they excel in, such as math, history or biology, and if they score high enough on the exam, they can obtain college credit for a course they normally would have had to take.It can shave 3 or more credits off of their academic program of study once in college.

The admissions staff were known to have manually entered over 2,000 scores during any one admissions cycle. As of this past summer, those test scores are now arriving electronically and loading into Banner – our student information system. However, there is a third party system we are using to evaluate those test scores and how the AP credit can be applied towards Temple programs. That system is where the admissions staff used to key in the test scores, and that is my part of what is now a two-step automated process- I have to take the scores out of Banner, and massage the data and get it into the third party solution, where the actual evaluation of AP credit to Temple credit occurs.

My team and I have made good progress so far and I was testing my part yesterday. The university has dozens of types of tests that come in for students such as entrance exams (SATs, ACTs, MCATS, LSATS, etc) and placement tests. The AP scores are designated in such a manner that the first two characters of the test code are “AP”. So for example, “AP20” is a biology test, “AP25”  Chemistry, etc.

In my querying of the database, I was grabbing all AP tests that had been added to students’ records , with a score of at least three, and that had no “DR” code in another column. However, in my result set I was getting tests that did not start with AP. Where were those EETK, MP1, MP2, MP3, EESS scores coming from ?

parens_trouble1_092316

After scratching my head a bit and a few expletives mumbled under my breath, the “Ah ha” moment arrived. Lines 7 and 8. The lack of properly placed parens (parenthesis) with the ANDs and OR was doing me in. Once I got them right, my result set looked much better.

parens_trouble2_fixed_092316

Moral of the story – you can never be too careful, even when you “think” you have this SQL thing nailed down. Take the time to check yourself!

 

Advertisements

Tags: , , , ,

About Helen J. Sanders

Assistant Director, Applications Development Services in the Student Collaboration Center at Temple University. Oracle database developer and enthusiast. Active in ODTUG. Serving on the Board of Directors for the Temple University Alumni Association, the Temple College of Education Alumni Association, and Vice President of the Network of Women with Careers in Technology.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: