A complex SQL query including string comparsion
Not what you're looking for?
I have written the following query:
SELECT FirstName, LastName,(0.8*(Quiz1+Quiz2+Quiz3)+MidTermPoints+1.2*FinalExam) as Score
FROM Students, QuizScores, TestScores
WHERE Students.StudentID = QuizScores.StudentID AND Students.StudentID = TestScores.StudentID AND QuizScores.StudentID = TestScores.StudentID AND Major LIKE '%A%' OR '%C%'
ORDER BY Score DESC
This is suppose to indicate the first name, last name, and score of the course of students who have a major that contains an 'A' or 'C' in it in descending order. I was required to combine three tables (students, quizscores, and testscore) to get the answer. I did something wrong, and not all students with 'A' or 'C' in their majors is showing up when I input my queries into the SQL program.
Purchase this Solution
Solution Summary
This solution explains a complex SQL query. The query has string comparison and Boolean expressions.
Solution Preview
The condition has two parts. The first part links all of the tables based on StudentID. The second part checks for those students with a Major that matches the given pattern.
The first part can be done with the following:
(Students.StudentID = ...
Purchase this Solution
Free BrainMass Quizzes
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.
Basic Networking Questions
This quiz consists of some basic networking questions.
C# variables and classes
This quiz contains questions about C# classes and variables.
Basic Computer Terms
We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.