Question

How do you write an UPDATE to remove specific words in SQL? Question: 1. Write SQL...

How do you write an UPDATE to remove specific words in SQL?

Question:

1. Write SQL to remove 'Airlines' from any carrier that has it. For example, if 'Delta Airlines' is in the table, your SQL should change that value to just 'Delta'. This must be a single query that addresses all records that have 'Airlines' in them, and should fix them all at the same time. It must be written with the assumption that other records containing 'Airlines' could exist, and if they did exist, it should address them as well.

Note: Table name: Airlines

Column Name: AirlineName

Values: (Virgin Atlantic, Frontier Airlines, Southwest Airlines, Delta Airlines)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

We use the Replace function to replace the Airline keyword in the table. It will search for Airlines in AirlineName column and make it as null wherever Airlines present.

UPDATE Airlines
SET AirlineName = replace(AirlineName, 'Airlines', ' ')
WHERE AirlineName LIKE '%Airlines';

Output:
Rows affected:4

Let me know in case if you have any doubts. Thanks and All the best.

Add a comment
Know the answer?
Add Answer to:
How do you write an UPDATE to remove specific words in SQL? Question: 1. Write SQL...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For each question, write a SQL query and save it as a "sql" file using a...

    For each question, write a SQL query and save it as a "sql" file using a different query 2, etc. Please execute these queries sequentially name, for example, query1.query product id (PK) category brand production_cost (Not Null) (FK) name (Not Null) Toothpaste Supermarket 1 Multivitami Supermarket 2 Shampoo acket T-shirt Supplements Supermarket Department4 Department5 Pharmacy Pharmacy 6 6 10 Query1. Update the Product table by adding another column as shown above ucts (name) with uery2. Retrieve all the uction cost...

  • SQL Queries – in this assignment you will be asked to create several SQL queries relating...

    SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...

  • 1) Write SQL to return the first and last name of all actors with a first...

    1) Write SQL to return the first and last name of all actors with a first name of "ADAM" (use the ACTOR table) 2) Write SQL with the LIKE operator to return addresses that are in the "Dhaka" district and have street addresses that do not contain the character sequence "Loop". You can return all information from the ADDRESS table that matches this criteria. 3) Write SQL with the BETWEEN and ORDER BY clause to return the payments in descending...

  • Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587...

    Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587 When all of your queries are complete, cut and paste the SQL Syntax into a word document. In order to see what the column names are, you need to click on the table and then Columns to see the field names. Make sure to include column headings that make sense in the queries (use the as “Field Name” after the field selected). Multi-table Queries...

  • For the questions below, write the SQL statement and also answer the question if requested. You n...

    Thumbs up for the Correct answer with all steps For the questions below, write the SQL statement and also answer the question if requested. You need to show the execution result of each SQL statement. 1. Create a sequence object (named with SalespersonIDSeq) which starts with 11, is increased by 1 with nocycle 2. Insert two new salesperson records below into Salesperson _T table. number generated using SalespersonIDSeq object For SalespersonID, use a sequence <SalespersonName: Brandon Young, SalespersonCity: Fort Wayne,...

  • Put all of your SQL code in a file named grades.sql and submit it below. Download...

    Put all of your SQL code in a file named grades.sql and submit it below. Download the starter code, which contains import_grades.sql and the grades.csv file. Using he import_grades, sql file, create your database and table. - 0 eded. 1 T Une Modify the LOAD DATA INFILE to correct the path to load the grades.csv file, and add/remove LOCAL he only modification you may make to the import_grades.sql or the grades.csv files. The data represents grades for assignments in a...

  • Create the database and tables for the database. Show all SQL statements. Include primary and foreign...

    Create the database and tables for the database. Show all SQL statements. Include primary and foreign keys. Insert data into each table. Show select statements and display the output of each table. Note:Student’s name must be inserted into table as part of the data! Perform the SQL below: Query one table and use WHERE to filter the results. The SELECT clause should have a column list, not an asterisk (*). State the purpose of the query; show the query and...

  • Please access to TUN SQL/Assistant using the default database = db_pvfc12_std 1.- Run a query to...

    Please access to TUN SQL/Assistant using the default database = db_pvfc12_std 1.- Run a query to retrieve all the data field from db_pvfc12_std in table CUSTOMER_T 2.- Run a query to retrieve record --> CustomerID = 11, How many records did you get and why? 3.- Run a query to retrieve all the data field from table Order_T               Once retrieved:                              3.1.- Please name the fields showing: Primary Key, Foreign Key and other fields                              3.2.- What type of...

  • Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add...

    Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add a new record to Territories table. Call it NewTerr. Add the following records using the procedure. TerritoryID        TerritoryDescription     Region 88888 Brooklyn 1 99999 Waco 4 77777 Long Beach 2 2. Create an Update Procedure that will change the Region from 1 to 3 for record with TerritoryID 88888. Call it Update88. 3. Create a Delete Procedure that will delete the one record from...

  • 4. Write SQL data definition commands for each of the following queries: a. How would you add an attribute, Class, to the Student table? b. How would you remove the Registration table? c. How would you change the FacultyName field from 25 characters

    Problems and Exercises 1 through 9 are based on the dass scheduling 3NF relations along with some sample data shown in Figure 6-11. Not shown in this figure are data for an ASSIGNMENT relation, which represents a many-to-many relationship between faculty and sections.4. Write SQL data definition commands for each of the following queries:a. How would you add an attribute, Class, to the Student table?b. How would you remove the Registration table?c. How would you change the FacultyName field from...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT