Table building_type(Update)Write a query to change the name 'Pharmacy' to 'Hospital' in the building_type table.
Question
Write a query to change the name 'Pharmacy' to 'Hospital' in the building_type
table.
Solution
Sure, here is the SQL query to update the name from 'Pharmacy' to 'Hospital' in the building_type table:
UPDATE building_type
SET name = 'Hospital'
WHERE name = 'Pharmacy';
Here is the step by step explanation:
-
UPDATE building_type
: This line is telling SQL that we want to update the table namedbuilding_type
. -
SET name = 'Hospital'
: This line is telling SQL what the update needs to be. In this case, we want to change thename
field to 'Hospital'. -
WHERE name = 'Pharmacy'
: This line is telling SQL where it should make this update. We only want to update the rows where thename
is currently 'Pharmacy'.
Similar Questions
Write a query to change the owner_name 'Nicholas' to 'Alexander' present in the building table
Write a query to change the owner_name 'Nicholas' to 'Alexander' present in the building table.
Write a query to change the type of field 'owner_name' in the 'building' table to varchar(500).
Write a query to modify the datatype of the column departmentId from VARCHAR(30) to INT in the table 'department'.Refer to the existing table DLL given below:
Write an UPDATE statement on the customers table to SET the years_old column to 42 for any customer with a last_name of Hall.
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.