+ 1

I have a weird situation with SQL code coaches. What should i do ?

I have problems with code coaches in SQL 10.1 ; tasks 1 & 3. Task 1 asks me to output films in this way : name Avengers:Endgame The Avengers However , my code : SELECT name FROM films WHERE year >= 2010 AND production = 'Marvel Studios'; Outputs this ; name The Avengers Avengers:Endgame It's not over. Task 3 asks me to output orders this way : name,age,distance,price Adam,38,2,500 Lisa,44,13,750 But my code : SELECT name, age, distance, price FROM orders WHERE price > 400 AND (Age > 40 OR distance < 10); Outputs them this way : name,age,distance,price Lisa,44,13,750 Adam,38,2,500 I tried adding "ORDER BY price" and it's variations , but i only get "ERROR" messages in response. I'm bringing up both of these because i think that I'm doing the same mistake in both of them. What do you think ?

7th Feb 2021, 4:49 PM
Kirill Chernyatin
Kirill Chernyatin - avatar
8 Antworten
+ 6
Кирилл Чернятин Should work. Try this SELECT name FROM films WHERE year >= 2010 AND production = 'Marvel Studios' ORDER BY name SELECT * FROM orders WHERE price > 400 AND (Age > 40 OR distance < 10) ORDER BY price
7th Feb 2021, 5:04 PM
A͢J
A͢J - avatar
+ 6
Кирилл Чернятин in 1st example You should add ORDER BY name after the WHERE condition in 2nd example add ORDER BY price
7th Feb 2021, 4:55 PM
A͢J
A͢J - avatar
+ 6
Кирилл Чернятин No problem, sometimes small mistake becomes big problem. Нет проблем, иногда маленькая ошибка становится большой проблемой.
7th Feb 2021, 5:44 PM
A͢J
A͢J - avatar
+ 4
Кирилл Чернятин I did nothing just added ORDER BY in your script.
7th Feb 2021, 5:08 PM
A͢J
A͢J - avatar
+ 1
I Am AJ ! It does not work. I only get the error response , but thank you nonetheless , AJ.
7th Feb 2021, 4:58 PM
Kirill Chernyatin
Kirill Chernyatin - avatar
+ 1
I Am AJ ! Both of them worked but , i have no idea how & why. Please , could you explain it to me ? I greatly appreciate what you already did for me & will completely understand if you'll refuse.
7th Feb 2021, 5:07 PM
Kirill Chernyatin
Kirill Chernyatin - avatar
+ 1
@I Am AJ ! Not exactly. It works when written like this : SELECT * FROM orders WHERE price > 400 AND (Age > 40 OR distance < 10) ORDER BY price But when written this way it does not work : SELECT * FROM orders WHERE price > 400 AND (Age > 40 OR distance < 10) ORDER BY price Oh , wait. Nevermind , it turns out that i finished the second line of code with a semicolon. My bad. Sorry for bothering you. Have a great night ! :).
7th Feb 2021, 5:12 PM
Kirill Chernyatin
Kirill Chernyatin - avatar
+ 1
I Am AJ ! Goodie , and i really appreciate that you take time to translate your response into Russian. It's not the first time you're doing it , but i always appreciate it. :).
7th Feb 2021, 5:45 PM
Kirill Chernyatin
Kirill Chernyatin - avatar