Computer Science, asked by dharavelu98, 9 months ago

Write a query to display car id, car name and car type of Maruthi company 'Sedan' type cars. Sort the result based on car id.

(HINT : Use Cars table to retrieve records.car name='Maruthi Swift'.car type='Sedan'.Data is case sensitive.)

Answers

Answered by poojan
12

Query:

SELECT `Car Id`, `Car Name`, `Car Type`  

FROM Cars

WHERE (`Car Name` = 'Maruthi')

     AND (`Car Type` = 'Sedan')

ORDER BY `Car Id`;

Explanation:

The syntax goes as

SELECT Column1, column2, ...

FROM Table_name

WHERE Condition1, condition2, ...

ORDER BY Columname ASC | DESC;

Here, the default ordering is the ascending one. The columns name, id, type [whose car name is Maruthi with type Sedan] are displayed in the order of ascending, based on the car id.

If you find a space in the column name, you need to either enclose them within the ' ` ' operator or within square brackets [] to make a valid column usage.

Learn more:

What are the maximum and the minimum number of rows returned by the R1 right outer join R2?

brainly.in/question/21195376

2. Write SQL commands for (a) to (e) on the basis of FAMILY relation given below

brainly.in/question/15115256

Answered by rabidlearner
5

Answer:

select car_id,car_name,car_type from Cars where Cars.car_name like "Maruthi%" and Cars.car_type="Sedan" order by car_id;

Explanation:

The main part being "Maruthi%" which signifies that the company name should start from Maruthi i.e. the required companies' name and % means that any character can come after the Maruthi.

Similar questions