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.
Question
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.
Solution
It seems like you're asking for a SQL query. Here's how you can do it:
SELECT *
FROM building
WHERE building_type_id IN (
SELECT building_type_id
FROM building_type
WHERE building_type_name = 'Library'
)
ORDER BY building_name;
This query works as follows:
-
The subquery
(SELECT building_type_id FROM building_type WHERE building_type_name = 'Library')selects thebuilding_type_idof the building type named 'Library'. -
The main query selects all columns from the
buildingtable wherebuilding_type_idis in the list of IDs returned by the subquery. -
The
ORDER BY building_nameclause sorts the result by thebuilding_namecolumn.
Please replace building_name and building_type_id with the actual column names in your tables if they are different. Also, make sure to run this query in your SQL environment to see if it works as expected.
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.Note:1. 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.
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.Note:1. Display only the name of building types that ends with L from building_type table.2. Order by is mandatory3. Compare your executed result with the sample output given below.
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.
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 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.
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.