Write a query to insert any 3 records into the 'building' table.Note:1. This ‘building’ table got foreign key reference. Already building_type table got below records in it. You no need to insert any new records into building_type table. Please insert records into building table alone by referring the below building_type_id.2. You can provide any values to the building id, owner_name, address, contact_number and email_address column. But for the building_type_id column you must refer to the values specified in the building_type id column only.3. Insert only 3 records into the building table SubmitPreviously Executed Queries
Question
Write a query to insert any 3 records into the 'building' table.Note:1. This ‘building’ table got foreign key reference. Already building_type table got below records in it. You no need to insert any new records into building_type table. Please insert records into building table alone by referring the below building_type_id.2. You can provide any values to the building id, owner_name, address, contact_number and email_address column. But for the building_type_id column you must refer to the values specified in the building_type id column only.3. Insert only 3 records into the building table SubmitPreviously Executed Queries
Solution
The language of the text is SQL (Structured Query Language). Here is how you can insert 3 records into the 'building' table:
INSERT INTO building (building_id, owner_name, address, contact_number, email_address, building_type_id)
VALUES (1, 'John Doe', '123 Main St', '1234567890', '[email protected]', 1);
INSERT INTO building (building_id, owner_name, address, contact_number, email_address, building_type_id)
VALUES (2, 'Jane Smith', '456 Elm St', '0987654321', '[email protected]', 2);
INSERT INTO building (building_id, owner_name, address, contact_number, email_address, building_type_id)
VALUES (3, 'Bob Johnson', '789 Pine St', '1122334455', '[email protected]', 3);
In this query, we are inserting 3 records into the 'building' table. Each record includes a building_id, owner_name, address, contact_number, email_address, and building_type_id. The building_type_id is a foreign key that references the 'building_type' table, so we are using the values 1, 2, and 3 which are assumed to be valid ids in the 'building_type' table.
Similar Questions
Write a query to insert any 3 records into the 'building' table.
Write a query to create 'building' table.Hint: Refer the schema diagram for the field names and its data type of the table.Note:This ‘building’ table got foreign key reference. You no need to create building_type table. It is already created for you.Field name and data type must be followed as such given in the schema diagram.There should not be any spelling mistakes in the field namesIf you specified wrong field name or missed any field name while creating the table, but if there is no syntax error then obviously the table will get created but it will not get Accepted.In this case, drop the table and recreate it again with correct field names and get it Accepted.
Write a query to create 'building' table.
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 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:
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.