I am unable to figure out what the answer is. Could anyone help me out? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I am unable to figure out what the answer is. Could anyone help me out?

Write a query to display the building type name of the meter number 'SG824012'. My ans : select name from building_type where id in (select id from building where id in (select building_id from meter where meter_number='sg824012'));

13th May 2023, 11:07 AM
nama purna chandrika
nama purna chandrika - avatar
2 Answers
+ 3
Can you please provide the task number?
13th May 2023, 5:25 PM
Sandeep
Sandeep - avatar
+ 1
nama purna chandrika some SQL engines require that all subqueries are named with the phrase AS <name>, even though you might not use the name. SQL Server is one that I know requires it. For example: (... WHERE id IN (SELECT building_id FROM meter WHERE meter_number='SG824012') AS BuildingId) ... Notice that I added AS BuildingId. You would also use similar syntax on the subquery that contains that subquery.
14th May 2023, 5:16 AM
Brian
Brian - avatar