Question

Q12. (12 pts) Write SQL statements to insert the following 3 cities as well as your...

Q12. (12 pts) Write SQL statements to insert the following 3 cities as well as your home city into the city table. If your home city is already listed, then add a different city you have visited. Leave the Population column of the last city empty. If your home country is not listed in the country table, you may also leave the Country column empty and add a comment in your SQL script file to explain this.

Then write a SQL query to list all the cities in the City table (show all the columns). For this question, you only need to submit the output of the last step.

Name Country Population Capital
1 washington d.c. united states

681170

Y
2 london united kingdom

8788000

Y
3 iowa city united states

74398

N

Q13 (6 pts). Add 100 to the population of all the cities in the United States. Write a SQL query to list all the affected cities and their new population values. For this question, you only need to submit the output of the last step.

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

12.

i. INSERT INTO city (Name,Country,population,capital) VALUES ('washington d.c.','united states',681170,'Y');

ii. INSERT INTO city (Name,Country,population,capital) VALUES ('london.','united kingdom',8788000,'Y');

iii. INSERT INTO city (Name,Country,population,capital) VALUES ('iowa city','united states',74398,'N');

iv. INSERT INTO city (Name,Country,population,capital) VALUES ('chennai','india',4900000,'N');

13.

-- Update keyword is used to update the table

UPDATE city

--- population increases by 100 if country is united states

SET population = population+100

WHERE Country = 'united states';

Add a comment
Know the answer?
Add Answer to:
Q12. (12 pts) Write SQL statements to insert the following 3 cities as well as your...
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
  • Write SQL to create a table called City in your account. The schema of the table...

    Write SQL to create a table called City in your account. The schema of the table is listed below. You must define the data types and not null constraint (if needed) of every column and all the primary key and foreign key constraints for the table. No screenshot needed for this question. City (Name, Country, Population, Capital). Name: the name of the city. Text string with maximum 50 characters. Must not be null. Country: the name of the country where...

  • 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...

  • 5. (3 pts) Write a SQL command that will insert a record into the “appts” table...

    5. (3 pts) Write a SQL command that will insert a record into the “appts” table above for a student named “Kelly”, where the advisor is “JSR”, and the room number is 5. 6. (3 pts) Write a SQL command that will display the name of students that are associated with the advisor named “JSR”. 7. (7 pts) Use the FRIENDS table to answer the following questions. LASTNAME        FIRSTNAME        AREACODE PHONE    ST ZIP --------------- ---------------- -------- -------- -- ------ BUNDY          ...

  • SQL Homework exercises: 1. Write INSERT statements that add two rows to the Members table for...

    SQL Homework exercises: 1. Write INSERT statements that add two rows to the Members table for member IDs 1 and 2, two rows to the Groups table for group IDs 1 and 2, and three rows to the Group_Membership table: one row for member 1 and group 2; one for member 2 and group 1; and one for member 2 and group 2. Then, write a SELECT statement that joins the three tables and retrieves the group name, member last...

  • 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...

  • Use MS Access software to build tables, as well as write, and execute queries. Submit the...

    Use MS Access software to build tables, as well as write, and execute queries. Submit the database and screenshots of all tables and queries. Step by step snapshots included. Don't want queries. Just process of creating this data step by step in Access. Create your own data. Ensure the data will test all criteria and prove all sorts worked as required. Be sure that all tables and queries have descriptive names. “Query 1” and “Step 1” are examples of poor...

  • Please refer to the following business scenarios: (i) Using SELECT statements of SQL, find the employee...

    Please refer to the following business scenarios: (i) Using SELECT statements of SQL, find the employee id, first name, last name, job title and email of all employees working in Asia (i.e. all countries coming from the region     ‘Asia’). This query must be implemented as a nested query! (ii) Using SELECT statements of SQL, find the employee id, first name, last name, job title and supervisor id of employees who had worked for more than 3 years and completed...

  • Do these codes look right for the following 5 statements. This is using Oracle SQL: Write...

    Do these codes look right for the following 5 statements. This is using Oracle SQL: Write a query that displays the title, ISBN, and wholesale cost of books whose wholesale cost is more than the average of all books. Format the retail price with dollars and cents. Write a query that displays the title and publication date of the oldest book in the BOOKS table. Format the date with the complete name of the month and a comma after the...

  • 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...

  • Write the following SQL statements in Microsoft Access by using the Books database from Week 2...

    Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...

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