Knowee
Questions
Features
Study Tools

Display only the contact_number column present in the building table where building_type name is ‘Police Station’. Use subqueries to achieve this.2. Tables involved are building_type and building.3. Order by is mandatory.4. Compare your executed result with the sample output given below.

Question

Display only the contact_number column present in the building table where building_type name is ‘Police Station’. Use subqueries to achieve this.2. Tables involved are building_type and building.3. Order by is mandatory.4. Compare your executed result with the sample output given below.

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

Solution

It seems like you're asking for a SQL query. Here's how you can do it:

SELECT contact_number 
FROM building 
WHERE building_type_id IN (
    SELECT building_type_id 
    FROM building_type 
    WHERE building_type_name = 'Police Station'
) 
ORDER BY contact_number;

Here's the step by step explanation:

  1. The subquery SELECT building_type_id FROM building_type WHERE building_type_name = 'Police Station' is used to find the building_type_id of the 'Police Station' from the building_type table.

  2. This building_type_id is then used in the main query to filter the building table and get the contact_number of buildings where building_type_id is the same as the one we got from the subquery.

  3. Finally, the ORDER BY contact_number is used to sort the result by contact_number.

Please replace the table and column names with the actual ones in your database if they are different.

This problem has been solved

Similar Questions

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.Note:1. Display only the contact_number column present in the building table where building_type name is ‘Police Station’. Use subqueries to achieve this.2. Tables involved are building_type and building.

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.Note:1. Display only the contact_number column present in the building table where building_type name is ‘Police Station’. Use subqueries to achieve this.2. Tables involved are building_type and building.3. Order by is mandatory.4. Compare your executed result with the sample output given below.Sample output:SubmitSaveExecutePrevious Submission

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.

Display only the name column present in the building_type table where meter_number is ‘SG824012’. Use subqueries to achieve this.2. Tables involved are building_type, building and meter.3. Compare your executed result with the sample output given below.Sample output:

Write a query to display the meter_number of the building_type named 'College'. Display the records in ascending order based on their meter_number.Note:1. Display only the meter_number column present in the meter table where building_type name is ‘College’. Use subqueries to achieve this.2. Tables involved are building_type, building and meter.3. Order by is mandatory4. Compare your executed result with the sample output given below.

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.