Write a query to display all the building details in which building_type named ‘Library’. Display the records in ascending order based on their owner_name
Question
Write a query to display all the building details in which building_type named ‘Library’. Display the records in ascending order based on their owner_name
Solution
Assuming you are using SQL, here is a step-by-step guide on how to write the query:
-
Start by specifying what you want to select. In this case, you want to select all building details. So, you start your query with
SELECT *
. -
Next, specify from which table you want to select the details. Let's assume the table is named
Buildings
. So, you addFROM Buildings
. -
Now, you want to filter the results to only include buildings where the
building_type
is 'Library'. You do this with aWHERE
clause:WHERE building_type = 'Library'
. -
Finally, you want to order the results in ascending order based on the
owner_name
. You do this with anORDER BY
clause:ORDER BY owner_name ASC
.
So, your final query would look like this:
SELECT *
FROM Buildings
WHERE building_type = 'Library'
ORDER BY owner_name ASC;
This query will return all columns from the Buildings
table where the building_type
is 'Library', and the results will be sorted in ascending order by the owner_name
.
Similar Questions
Write a query to display the name of all building types that ends with letter 'l'. Display the records in ascending order based on name
Write a query to display all the details of the 'building' whose owner_name is 'Nicholas'.
Write a query to display all the contact number of the building_type named 'Police Station'. Display the records in ascending order based on the contact number
Write a query to change the owner_name 'Nicholas' to 'Alexander' present in the building table.
Write a query to display the entire contents of the 'slab' details.Display the records in ascending order based on their 'from_unit'.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.