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_typeis 'Library'. You do this with aWHEREclause:WHERE building_type = 'Library'. -
Finally, you want to order the results in ascending order based on the
owner_name. You do this with anORDER BYclause: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 owner_name and contact_number of all building, Display the records in ascending order based on owner_name.
Display all the column present in the building table where building_type name is ‘Library’. Use subqueries to achieve this.2. Tables involved are building_type and building3. Order by is mandatory.4. Compare your executed result with the sample output given below.
Write a query to display the entire details of the 'building' whose owner_name starts with the letter 'M', Display the records in ascending order based on their owner_name.
Write a query to display the entire details of the building whose building_type_id is 2, sorted by owner_name in ascending order.Note:1. Display all the columns present in the building table.2. Specify the condition and retrieve the correct rows in the result(condition need to be specified on building_type_id column).3. You can compare your executed result with the sample output given below.4. Order by is mandatorySample output:
Write a query to display all the details of the buildings whose owner name contains 'di' in ascending order based on the owner name of the building.Note:1. Display all the columns from the building table whose owner_name contains “di” from building table.2. Order by is mandatory3. Compare your executed result with the sample output given below.
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.