Knowee
Questions
Features
Study Tools

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.

Question

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.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Based on your instructions, it seems like you are asking for a SQL query. Here is a step-by-step guide on how to write this query:

  1. First, you need to select all columns from the building table. This is done using the SELECT * statement. The asterisk (*) is a wildcard character that represents all columns.

  2. Next, you need to specify the table you are selecting from. This is done using the FROM keyword followed by the name of the table. In this case, the table name is building.

  3. Then, you need to filter the results to only include rows where the owner_name contains 'di'. This is done using the WHERE keyword followed by the condition. The LIKE keyword is used to search for a specified pattern in a column. The percent sign (%) is a wildcard character that represents zero, one, or multiple characters. So, owner_name LIKE '%di%' will match any owner_name that contains 'di'.

  4. Finally, you need to order the results in ascending order based on the owner_name. This is done using the ORDER BY keyword followed by the column name and the ASC keyword for ascending order.

Here is the complete SQL query:

SELECT *
FROM building
WHERE owner_name LIKE '%di%'
ORDER BY owner_name ASC;

This query will return all the details of the buildings whose owner name contains 'di', ordered in ascending order by the owner name.

This problem has been solved

Similar Questions

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.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 owner_name column).3. You can compare your executed result with the sample output given below.4. Order by is mandatorySample output: [Only few records are shown here]

Write a query to display the owner_name and contact_number of all building, Display the records in ascending order based on owner_name.Note:1. Display only the column named ‘owner_name’ and ‘contact_number’ present in the building table.2. Order by is mandatory

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 the owner name and the length of the owner's name of the buildings. Display the records in ascending order based on owner name. Give an alias as name_length to the length of the owner names.Use the inbuilt function length().Note:1. Display only the owner name and length of the owner_name from building table.2. Specify the alias name without any mistake.3. Order by is mandatory4. Compare your executed result with the sample output given below.Sample output:[only few records shown here]

Write a query to display all the details of the buildings, whose building type name contains a letter 'e' but do not contain a letter 'a'. Display the records in descending order based on their owner_name.Note: Use 'Minus'Note:1. Display all the details of the buildings contains a letter 'e' but do not contain a letter 'a'.2. Order by is mandatory. 3. Use Minus.4. Compare your executed result with the sample output given below.Submit

1/3

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.