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
Textbook Question
Chapter 7, Problem 4CAT
Write, but do not execute, the commands to grant the following privileges:
- a. User Rodriquez must be able to retrieve data from the TRIP table.
- b. Users Gomez and Liston must be able to add new reservations and customers to the
database . - c. Users Andrews and Zimmer must be able to change the price of any trip.
- d. All users must be able to retrieve the trip name, start location, distance, and type for every trip.
- e. User Golden must be able to add and delete guides.
- f. User Andrews must be able to create an index for the TRIP table.
- g. Users Andrews and Golden must be able to change the structure of the CUSTOMER table.
- h. User Golden must have all privileges on the TRIP, GUIDE, and TRIP_GUIDES tables.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Task 5:
The Developers team also wants you to ensure that emails are converted to lowercase after an update operation. Currently, new insertions are guaranteed to have lowercase emails, but there is no such guarantee for legacy emails. Therefore, the team wants to ensure that emails are being retained in a lowercase irrespective of any changes in the database. Create a new TRIGGER called email_update for the USERS table that runs before an UPDATE operation.
Task: Create a TRIGGER to run on the USERS table before any UPDATE operation.
(SQL Database Test): Create a TRIGGER before any UPDATE operations on the USERS table
Task 5:
The Developers team also wants you to ensure that emails are converted to lowercase after an update operation. Currently, new insertions are guaranteed to have lowercase emails, but there is no such guarantee for legacy emails. Therefore, the team wants to ensure that emails are being retained in a lowercase irrespective of any changes in the database. Create a new TRIGGER called email_update for the USERS table that runs before an UPDATE operation.
Create a table in your own database using the following statement. CREATE TABLE DateRange (DateID INT IDENTITY, DateValue DATE, DayOfWeek SMALLINT, Week SMALLINT, Month SMALLINT, Quarter SMALLINT, Year SMALLINT ); Write a stored procedure that accepts two parameters: A starting date The number of the consecutive dates beginning with the starting date The stored procedure then inserts data into all columns of the DateRange table according to the two provided parameters.
Chapter 7 Solutions
A Guide to SQL
Ch. 7 - What is a view?Ch. 7 - Which command creates a view?Ch. 7 - Prob. 3RQCh. 7 - What happens when a user retrieves data from a...Ch. 7 - What are three advantages of using views?Ch. 7 - Which command deletes a view?Ch. 7 - Prob. 8RQCh. 7 - Which command terminates previously granted...Ch. 7 - Prob. 10RQCh. 7 - How do you create an index? How do you create a...
Ch. 7 - Prob. 12RQCh. 7 - Does the DBMS or the user make the choice of which...Ch. 7 - Describe the information the DBMS maintains in the...Ch. 7 - The CUSTOMER table contains a foreign key,...Ch. 7 - Prob. 16RQCh. 7 - Prob. 17RQCh. 7 - Prob. 18RQCh. 7 - Prob. 19RQCh. 7 - When would you usually specify primary key...Ch. 7 - Prob. 21RQCh. 7 - Prob. 22RQCh. 7 - Prob. 23RQCh. 7 - Use SQL to make the following changes to the TAL...Ch. 7 - Create a view named ITEM_ORDER. It consists of the...Ch. 7 - Create a view named ORDER_TOTAL. It consists of...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5TDCh. 7 - Perform the following tasks: a. Create an index...Ch. 7 - Delete the index named ITEM_INDEX3.Ch. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9TDCh. 7 - Prob. 10TDCh. 7 - Toys Galore currently has a credit limit of 7,500....Ch. 7 - Use SQL to make the following changes to the...Ch. 7 - Create a view named RESERVATION_CUSTOMER. It...Ch. 7 - Create a view named TRIP_INVENTORY. It consists of...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5CATCh. 7 - Create the following indexes: a. Create an index...Ch. 7 - Prob. 7CATCh. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9CATCh. 7 - Ensure that the only legal values for the TYPE...Ch. 7 - Prob. 11CATCh. 7 - Use SQL to make the following changes to the...Ch. 7 - Create a view named CONDO_OWNERS. It consists of...Ch. 7 - Create a view named CONDO_FEES. It consists of two...Ch. 7 - Write, but do not execute, the commands to grant...Ch. 7 - Prob. 5SCGCh. 7 - Prob. 6SCGCh. 7 - Delete the OWNER_INDEX 3 index from the OWNER...Ch. 7 - Write the commands to obtain the following...Ch. 7 - Prob. 9SCGCh. 7 - Ensure that the only legal values for the BDRMS...Ch. 7 - Prob. 11SCG
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
The ____________ is always transparent.
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
The following C++ program will not compile because the lines have been mixed up. cout Success\n; cout Success...
Starting Out with C++ from Control Structures to Objects (8th Edition)
While a program is running, a control is said to lose focus when the focus moves from that control to another c...
Introduction To Programming Using Visual Basic (11th Edition)
In Problems 1 through 10, find a function y=f(x) satisfying the given differential equation and the prescribed ...
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
Suppose your instructor gives three exams during the semester and you want to write a program that calculates y...
Starting out with Visual C# (4th Edition)
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
- What is the format of the SET clause that changes the value in a column to null in an UPDATE command?arrow_forwardCreate a view name TopLevelCust view. It consists of the number, name, address, balance, and credit limt of clients with credit limits that are greater that or equal to $10,000.arrow_forwardYou have a table that contains the following fields: MemberLastName, MemberFirstName, Street, City, State, ZipCode, and MembershipFee. There are 75,000 records in the table. What indexes would you create for the table, and why would you create these indexes?arrow_forward
- create a SQLITE database or use an existing database and create a table in the database called "Ages": CREATE TABLE Ages ( name VARCHAR(128), age INTEGER ) Then make sure the table is empty by deleting any rows that you previously inserted, and insert these rows and only these rows with the following commands: DELETE FROM Ages; INSERT INTO Ages (name, age) VALUES ('Darrius', 17); INSERT INTO Ages (name, age) VALUES ('Dustin', 25); INSERT INTO Ages (name, age) VALUES ('Aibidh', 24); INSERT INTO Ages (name, age) VALUES ('Baron', 33); INSERT INTO Ages (name, age) VALUES ('Kayden', 33); Once the inserts are done, run the following SQL command:SELECT hex(name || age) AS X FROM Ages ORDER BY X Find the first row in the resulting record set and enter the long string that looks like 53656C696E613333. Note: This assignment must be done using SQLite - in particular, the SELECT query above will not work in any other database. So you cannot use MySQL or Oracle for this assignment.arrow_forwardCreate a PL/SQL anonymous block to insert a new project in DoGood Donor database. Create and use a sequence to handle generating and populating the project ID. The first number issue by the sequence should be 800, and no caching should be used. Use a record variable to handle the data to be added. Data for the new row should be the following: project name is “Covid-19 relief fund”, start date: Feb 1, 2023, end date: Jun 30, 2023, and fundraising goal is half million. Any columns not addressed in the data list are currently unknown.arrow_forwardCreate a PL/SQL anonymous block to insert a new project in DoGood Donor database. Create and use a sequence to handle generating and populating the project ID. The first number issue by the sequence should be 600, and no caching should be used. Use a record variable to handle the data to be added. Data for the new row should be the following: project name is “Covid-19 relief fund”, start date: Feb 1, 2022, end date: Jun 30, 2022, and fundraising goal is half million. Any columns not addressed in the data list are currently unknown. 2.Create anonymous block to retrieve and display data for all pledges made in a specified month. One row of output should be displayed for each pledge. More specifically, each row include: Pledge ID, donor ID, and pledge amount If the pledge is being paid in a lump sum, display “Lump Sum” If the pledge is being paid in monthly, display “Monthly ** ” followed by number of months for payment The list should be sorted to display all lump sum pledges firstarrow_forward
- Question 2: Triggers and Stored Procedures Download the file named “assignment5_database.sql” from D2L. Run the file from MySQL command window using the command (assuming the file is stored under c:\\): mysql> source c:\\assignment5_database.sql After the file completes, the tables shown above are created and populated with the shown data. Familiarize yourself with the database before starting to write your queries. Once you are familiar with the data, start working on the following questions. Answer the following questions based on the above database: Create a view named “Atlanta_Charter_Crew_V” that includes the following “For each charter of aircraft to Atlanta (ATL), print the charter date, charter distance, and the corresponding crew (employee) number, last name, first name, and crew job”. Your answer should include both the SQL statement for view creation along with the contents of the view (you get the contents of the view by running the command select *…arrow_forwardThe StayWell Property Management team considers creating a discount scheme for the property owners with more than one property in the system. You will need to provide all the owner IDs ( OWNER_NUM ) and the count of properties of the owners with more than one active property in the database. The output columns should be OWNER_NUM and COUNT(*) respectively. Task Provide a list of owner IDs ( OWNER_NUM ) for owners of 0.00 out of 10.00 more than one active property. O out of 1 checks passed. Review the results below for more details.arrow_forwardTask 3: Create(Enter) new product by using a Procedure with IN Parameters Follow these steps to create a procedure that allows a company employee to add a new product to the database. This procedure needs only IN parameters. In SQL Developer, create a procedure named PROD_ADD_SP that adds a row for a new product in the BB_PRODUCT table. Keep in mind that the user provides values for the product name, description, image filename (use same template for file name as ‘roasted.jpg’ or ‘double-roasted.jpg’ ) , price, and active status. Address the input values or parameters in the same order as in the preceding sentence. Call the procedure with these parameter values: ('Roasted Blend', 'Well-balanced mix of roasted beans, a medium body', 'roasted.jpg',9.50,1). Check whether the update was successful by querying the BB_PRODUCT table. -This will be a page where you allow new product information to be entered into Edit box by end user and then there will be INSERT or ADD Product…arrow_forward
- Sales Database: Customers(custId, lastName, firstName, address, phone, creditLimit) Orders(ordNumber, itemNumber, qtyOrdered.) Items(itemNumber, itemName, price) For the Sales Database referenced above, write the SQL command to create the LineItem table, assuming the Orders table and items table already exist.arrow_forwardWhich of the following commands can be used to eliminate the RECEPTIONIST role? (refer to the JustLee Books database).a. DELETE ROLE receptionist;b. DROP receptionist;c. DROP ANY ROLE;d. none of the abovearrow_forward2. Create a trigger that will maintain the correct value in the membership balance in theMEMBERSHIP table when videos are returned late. The trigger should execute as anFOR/AFTER trigger when the due date or return date attributes are updated in theDETAILRENTAL table. The trigger should satisfy the following conditions. a) Calculate the value of the late fee prior to the update that triggered this execution ofthe trigger. The value of the late fee is the days late times the daily late fee. If theprevious value of the late fee was null, then treat it as zero (0).b) Calculate the value of the late fee after the update that triggered this execution of thetrigger. If the value of the late fee is now null, then treat it as zero (0).c) Subtract the prior value of the late fee from the current value of the late fee todetermine the change in late fee for this video rental.d) If the amount calculated in part c is not zero (0), then update the membership balanceby the amount calculated for the…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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
dml in sql with examples; Author: Education 4u;https://www.youtube.com/watch?v=WvOseanUdk4;License: Standard YouTube License, CC-BY