can you help me with code practice sql | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

can you help me with code practice sql

write a query to select the car make, model and price per day from the cars table where the price per day is less than or equal to $100 SELECT price >= $100 AS result FROM cars; doesn't answer...

4th Nov 2023, 6:48 AM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
20 Answers
+ 6
-- your code SELECT price >= $100 AS result FROM cars; -- the field name is price_per_day -- price less not greater than -- the values are numbers without $ sign -- you don't need to change the field name -- you don't need to show ture and false, but use them to filter the table
4th Nov 2023, 9:30 AM
Mafdi
Mafdi - avatar
+ 4
As Wong Hei Ming said you need 3 fields -- Try SELECT make, model, price FROM cars WHERE price >= 100; --or SELECT * FROM cars WHERE price >= 100;
4th Nov 2023, 8:51 AM
SoloProg
SoloProg - avatar
+ 4
yes this is answer
4th Nov 2023, 1:03 PM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 3
/* fields to show: (make, model, price_per_day) of cars table show record if price per day is less than or equal to $100 */
4th Nov 2023, 9:15 AM
Mafdi
Mafdi - avatar
+ 3
SELECT * FROM cars WHERE price_per_day >= 100; doesn't answer no input
4th Nov 2023, 10:17 AM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 3
The answer is... Select car_make,model,price from cars where price >=100;
4th Nov 2023, 1:49 PM
🎯🩷 Anushka 🎯🩷
🎯🩷 Anushka 🎯🩷 - avatar
+ 2
-- Try SELECT price AS result FROM cars WHERE price >= 100;
4th Nov 2023, 7:59 AM
SoloProg
SoloProg - avatar
+ 2
dosen't answer
4th Nov 2023, 8:12 AM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 2
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪 There are 2 issues in your code. The question specify which fields are required, yet you select them all. It asks "less than or equal to $100", yet you do the opposite.
4th Nov 2023, 10:22 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 2
--there is a typo "per" --less than < not greater than > --you should not show the id field
4th Nov 2023, 10:24 AM
Mafdi
Mafdi - avatar
+ 2
SELECT * FROM cars WHERE price_per_day <> 100; doesn't answer it out puts it has not input
4th Nov 2023, 10:38 AM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 2
SELECT * FROM cars WHERE price = 100; doesn't answer
4th Nov 2023, 11:36 AM
AMIR H R A<ヾ(@^▽^@)ノ >LION 💪
AMIR  H  R A<ヾ(@^▽^@)ノ >LION 💪 - avatar
+ 2
DONFY thanx...and do not worry! Its your beginning....via coding....u can learn perfect English too...!!😄👍🤗
4th Nov 2023, 2:05 PM
🎯🩷 Anushka 🎯🩷
🎯🩷 Anushka 🎯🩷 - avatar
+ 1
Is it an exercise from a course? If yes, please mention the course and exercise name in the description. Judging from your profile, isn't it from "Coding Foundations", exercise "Select your car"? The question ask for 3 fields. Your SQL statement only selected 1 field and the conditional clause is wrong.
4th Nov 2023, 8:36 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
SoloProg From your profile I see you already passed intro to SQL, which also includes the same exercise. Yet your solution won't work because of wrong field name. Also, please don't provide ready made code. Give hints so OP can learn from their mistake.
4th Nov 2023, 8:56 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
It seems like you're on the right track, but the query you provided is not quite correct. You need to use a `SELECT` statement to retrieve specific columns from the `cars` table, and then use a `WHERE` clause to filter the results based on the condition that the price per day is less than or equal to $100. Here's the correct SQL query: ```sql SELECT make, model, price_per_day FROM cars WHERE price_per_day <= 100; ``` This query will select the `make`, `model`, and `price_per_day` columns from the `cars` table, and only include rows where the `price_per_day` is less than or equal to $100.
4th Nov 2023, 12:05 PM
রহস্যময়— পৃথিবী
রহস্যময়— পৃথিবী - avatar
+ 1
✨💕Anushka💕✨ My level of English is not very basic, so I sometimes confuse what the test actually says, so congratulations.
4th Nov 2023, 2:04 PM
DONFY
DONFY - avatar
4th Nov 2023, 2:08 PM
DONFY
DONFY - avatar
0
I don't know if this will help you, but price <=100 , or price < 100
4th Nov 2023, 11:57 AM
DONFY
DONFY - avatar
0
SELECT make,model,price_per_day FROM cars WHERE price_per_day<=100
20th Dec 2023, 6:44 AM
Bonginkosi Khoza
Bonginkosi Khoza - avatar