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
Question
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.
Solution
Assuming you are using SQL, here is a step-by-step guide on how to write the query:
-
First, you need to select the column you are interested in, which is the name of the building types. In SQL, you use the SELECT statement for this. If the column name is "building_type", the beginning of your query will look like this:
SELECT building_type
. -
Next, you want to specify that you're only interested in building types that end with the letter 'l'. For this, you use the WHERE clause in combination with the LIKE keyword. The '%' symbol is used as a wildcard in SQL, meaning it can represent any number of characters. So, to specify that the building type should end with 'l', you add
WHERE building_type LIKE '%l'
to your query. -
Finally, you want to order the results in ascending order based on the name. For this, you use the ORDER BY clause. To specify ascending order, you use the ASC keyword. So, you add
ORDER BY building_type ASC
to your query.
Putting it all together, your final query will look like this:
SELECT building_type
FROM your_table
WHERE building_type LIKE '%l'
ORDER BY building_type ASC;
Please replace "your_table" with the actual name of your table.
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 all the contact number of the building_type named 'Police Station'. Display the records in ascending order based on the contact number
Write a MySQL statement to sort the students in descending order of the last name
Write a query to display all the details of the 'building' whose owner_name is 'Nicholas'.
Use a UNION to create a list of all the employee's and customer's first names and last names ordered by the last name in descending order.
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.