Write a query to create 'building' table.
Question
Write a query to create 'building' table.
Solution
Sure, here is a basic example of how you can create a 'building' table using SQL:
CREATE TABLE building (
id INT PRIMARY KEY,
name VARCHAR(100),
address VARCHAR(255),
floors INT
);
In this example, the 'building' table has four columns:
- 'id' is of type INT and is the primary key.
- 'name' is of type VARCHAR and can store up to 100 characters.
- 'address' is of type VARCHAR and can store up to 255 characters.
- 'floors' is of type INT.
Please modify this query according to your requirements.
Similar Questions
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 insert any 3 records into the 'building' table.
Table building - InsertWrite 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
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 building_type name and the number of buildings under the type which has maximum number of buildings. Give an alias name for number of buildings as number_of_buildings and for building name as building_name. If there are multiple records sort in ascending order by building_name.Note:1. Display only the building_type name and no. of buildings in building_type table with the condition having maximum no. of buildings.2. Use Joins3. Tables involved are building and building_type4. Order by is mandatory. 5. Specify the alias name without any mistake.6. 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.