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
Question
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.
Solution
Sure, here is a SQL query that will display all the contact numbers of the building_type named 'Police Station' in ascending order:
SELECT contact_number
FROM buildings
WHERE building_type = 'Police Station'
ORDER BY contact_number ASC;
Here's a step-by-step breakdown of the query:
-
SELECT contact_number
: This part of the query selects the data to be displayed, which in this case is the contact number. -
FROM buildings
: This part of the query specifies the table from which to retrieve the data, which in this case is the 'buildings' table. -
WHERE building_type = 'Police Station'
: This part of the query filters the records to only include those where the building_type is 'Police Station'. -
ORDER BY contact_number ASC
: This part of the query sorts the resulting records in ascending order based on the contact number.
Similar Questions
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
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 the entire contents of the 'slab' details.Display the records in ascending order based on their 'from_unit'.
Write a query to display the entire contents of the 'electricity_connection_type'. Display the records in ascending order based on their connection name.
Write a query to display the connection name ,from_unit and to_unit and rate of all the slabs.Display the records in ascending order based on connection_name.
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.