A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 3, Problem 4TD
Explanation of Solution
Running the script file for TAL Distributors:
The script file consists of create query for five tables and add values to be added in the created five table.
Steps to run the script file in oracle:
- Open the “SQL Workshop” in the menu bar.
- Then select “SQL Scripts” in the “LABEL”
- Click “Upload” option. The “Upload Script” window will appear on the screen.
- Click the “Choose File” option. Then specify the file path containing the script file and then click “Open” button.
- Click the “Upload” button.
Screenshot of “Upload Script”
- Once the “Upload” button is clicked, the below table is displayed on the screen...
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
You are assigned as the database administrator to collect and manage transactional data of the InstantRide operations. Your main task is to create SQL scripts to help other teams to retrieve the requested data. In the following activities, you will create the scripts, run against the database and send the result to the corresponding teams.
Car Maintenance team wants to add new maintenance tasks to the MAINTENANCES table which was created in Chapter 8, Activity 1. However, the team also wants to insert the tasks in a batch into the database. In other words, they want to insert the rows all together without inserting one-by-one. Therefore, you will need to create a script to add the following tasks and ensure that they are added together:
Car ID: 1001, Maintenance Type: 2, Due: 2020-06-01
Car ID: 1003, Maintenance Type: 2, Due: 2020-06-01
You will need to add a CREATE DATABASE and USE database statement at the beginning of the script in the file of the Sample Database in order for SQL Script in the Sample Database to execute/run correctly
If you discover any ambiguity between the written Metadata and the actual table definitions, the path that I recommend is to use the SHOW TABLES Statement and the DESCRIBE Table Statement to eliminate any ambiguity between the written Metadata and the actual Metadata.
CustOrders.sql download
Aggregation Part of the Exercise
. Select the maximum price of any orders in the items_ordered table. Hint: Select the maximum price only.
. Select the average price of all of the orders that were purchased in the month of Dec.
. Return the total number of rows in the orders table?
. For all of the tents that were ordered in the orders table, what is the price of the lowest tent? Hint: Your query should return the price only.
Group By Exercises
. How many people are…
Use SQL to make the following changes to the Colonial Adventure Tours database (Figures 1-4 through 1-6 in Chapter 1). After each change, execute an appropriate query to show that the change was made correctly. If directed to do so by your instructor, use the information provided with the Chapter 3 Exercises to print your output or save it to a document. For any exercises that use commands not supported by your version of SQL, write the command to accomplish the task
Create a view named MAINE_TRIPS. It consists of the trip ID, trip name, start location, distance, maximum group size, type, and season for every trip located in Maine (ME)
a. Write and execute the CREATE VIEW command to create the MAINE_TRIPS view.b. Write and execute the command to retrieve the trip ID, trip name, and distancefor every Biking trip.c. Write and execute the query that the DBMS actually executes.d. Does updating the database through this view create any problems? If so, whatare they? If not, why not?
Chapter 3 Solutions
A Guide to SQL
Ch. 3 - Prob. 1RQCh. 3 - How do you delete a table using SQL?Ch. 3 - Prob. 3RQCh. 3 - Prob. 4RQCh. 3 - Prob. 5RQCh. 3 - Prob. 6RQCh. 3 - Prob. 7RQCh. 3 - Prob. 8RQCh. 3 - Prob. 9RQCh. 3 - Prob. 10RQ
Ch. 3 - Prob. 11RQCh. 3 - Prob. 12RQCh. 3 - Prob. 13RQCh. 3 - Use SQL to complete the following exercises....Ch. 3 - Prob. 2TDCh. 3 - Prob. 3TDCh. 3 - Prob. 4TDCh. 3 - Prob. 5TDCh. 3 - Prob. 6TDCh. 3 - Prob. 7TDCh. 3 - Prob. 1CATCh. 3 - Add the following row to the ADVENTURE_TRIP table:...Ch. 3 - Prob. 3CATCh. 3 - Prob. 4CATCh. 3 - Prob. 5CATCh. 3 - Prob. 6CATCh. 3 - Review the data for the TRIP table in Figure 1-5...Ch. 3 - Colonial Adventure Tours would like to increase...Ch. 3 - Prob. 1SCGCh. 3 - Add the following record to the VACATION_UNIT...Ch. 3 - Delete the VACATION_UNIT table.Ch. 3 - Prob. 4SCGCh. 3 - Prob. 5SCGCh. 3 - Prob. 6SCGCh. 3 - The SERVICE_REQUEST table uses the CHAR data type...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- An EMPLOYEES table was added to the JustLee Books database to track employee information. Display a list of each employee’s name, job title, and manager’s name. Use column aliases to clearly identify employee and manager name values. Include all employees in the list and sort by manager name.arrow_forwardDoes the DBMS or the user make the choice of which index to use to accomplish a given task?arrow_forwardUse SQL to make the following changes to the Colonial Adventure Tours database (Figures 1-4 through 1-6 in Chapter 1). After each change, execute an appropriate query to show that the change was made correctly. If directed to do so by your instructor, use the information provided with the Chapter 3 Exercises to print your output or save it to a document. For any exercises that use commands not supported by your version of SQL, write the command to accomplish the task. Create a view named MAINE_TRIPS. It consists of the trip ID, trip name, start location,distance, maximum group size, type, and season for every trip located in Maine (ME). a. Write and execute the CREATE VIEW command to create the MAINE_TRIPS view.b. Write and execute the command to retrieve the trip ID, trip name, and distancefor every Biking trip.c. Write and execute the query that the DBMS actually executes.d. Does updating the database through this view create any problems? If so, whatare they? If not, why notarrow_forward
- The DBA denormalized certain data in the TAL Distributors database for the sake of speed, and one of the resultant tables looks like this: Customer table is not in third normal form due to the following field(s): CustomerNum, CustomerName, Street, City, State, PostalCode, Balance, CreditLimit, RepNum, RepName. Under this situation, what does the normal form of the denormalized table look like?arrow_forwardThe property management team wants to ensure that the property and owner information always correspond. In other words, they do not want any property in the database where the OWNER_NUM information does not match with anyone in the OWNER table. You need to alter the PROPERTY table by changing the OWNER_NUM field to refer to the OWNER table. Alter the PROPERTY table by changing the OWNER_NUM field to refer to the OWNER table.arrow_forwardDo the tables exihibit referential integrity.Answer yes or no, and then explain your answer.arrow_forward
- The DBA denormalized some of the data in the TAL Distributors database to improve performance, and one of the resulting tables is the following: Customer (CustomerNum, CustomerName, Street, City, State, PostalCode, Balance, CreditLimit, RepNum, RepName) Which field or fields cause the table to no longer be in third normal form? In which normal form is the denormalized table?arrow_forwardHow to Dumping the users table from the Peruggia database, complete with passwordsarrow_forwardTo perform the following assignments, refer to the tables created in the JLDB_Build_5.sql script at the beginning of the chapter. 1) Add a new row in the ORDERS table with the following data: Order# = 1021, Customer# = 1009, and Order date = July 20, 2009. 2)Modify the zip code on order 1017 to 33222. 3)Save the changes permanently to the database. 4)Add a new row in the ORDERS table with the following data: Order# = 1022, Customer# = 2000, and Order date = August 6, 2009. Describe the error raised and what caused the error. 5)Add a new row in the ORDERS table with the following data: Order# = 1023 and Customer# = 1009. Describe the error raised and what caused the error. 6)Create a script using substitution variables that allows a user to set a new cost amount for a book based on the ISBN. 7)Execute the script and set the following values: isbn = 1059831198 and cost = $20.00. 8)Execute a command that undoes the change in Step 7. 9)Delete Order# 1005. You need to address both the…arrow_forward
- Not all versions of this database include referential integrity constraints for all foreign keys. Use whatever commands are available for the RDBMS you are using, investigate if any referential integrity constraints are missing. Write any missing constraints and, if possible, add them to the associated table definitions.arrow_forwardIn a relational DBMS, how are 'JOIN' and 'PROJECT' used to present information useful? JOIN provides combinations of tables, whereas PROJECT lists the subset values for the selected attribute. JOIN provides combinations of tables, whereas PROJECT create rows and columns of data in a table. JOIN lists the subset values for the selected attributes, whereas PROJECT provides combinations of tables. JOIN creates rows and columns of data in a table, whereas PROJECT provides combinations of tables.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr