+ 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...
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
+ 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;
+ 4
yes this is answer
+ 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
*/
+ 3
SELECT *
FROM cars
WHERE price_per_day >= 100;
doesn't answer no input
+ 3
The answer is...
Select car_make,model,price from cars where price >=100;
+ 2
-- Try
SELECT price AS result
FROM cars
WHERE price >= 100;
+ 2
dosen't answer
+ 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.
+ 2
--there is a typo "per"
--less than < not greater than >
--you should not show the id field
+ 2
SELECT *
FROM cars
WHERE price_per_day <> 100;
doesn't answer it out puts it has not input
+ 2
SELECT *
FROM cars
WHERE price = 100;
doesn't answer
+ 2
DONFY thanx...and do not worry! Its your beginning....via coding....u can learn perfect English too...!!๐๐๐ค
+ 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.
+ 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.
+ 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.
+ 1
โจ๐Anushka๐โจ My level of English is not very basic, so I sometimes confuse what the test actually says, so congratulations.
+ 1
+ 1
SELECT make,model,price_per_day
FROM cars
WHERE price_per_day<=100
0
I don't know if this will help you, but
price <=100 , or price < 100