I have tried there two queries, but I am told that I am not doing something right. Here are the criteria I used to write the queries and my current answers.
1. Write a SELECT statement that lists the StudentID, FirstName, LastName, and GPA of freshman (FR) whose GPA is 3.5 or higher. Use only the Student table.
SELECT StudentID, FirstName, LastName, GPA
WHERE Year like '%FR%' AND GPA >= 3.5
2. Write a SELECT statement that returns all the information for junior and senior students whose GPAs are lower than 3.0. Sort by LastName in descending order. Use only the Students table.
WHERE GPA < 3.0 and Year like '%JR%' OR '%SR%'
ORDER BY LastName DESC
How can I edit my queries so that they are completely correct. The SQLyog is returning the correct answers, but I keep getting marked incorrect.
Student, since you say "SQLyog is returning the correct answers" I suspect we only need to tweak your queries a bit. To be sure, I would liked you to have attached your query output and the Students table schema. I think the problem you are getting in your marks is because you are using "Year like" when you should use an "=" comparison. "=" is a more SARGable search parameter than "LIKE", meaning SQL is optimized to returnig "=" results faster and more efficiently using ...
Solution is a careful analysis to the queries as given for improvements.