Write a script that includes these statements coded

Assignment Help Basic Computer Science
Reference no: EM13760024

Use the given MyGuitarShop database to answer these questions. Include the written answers as comments in the SQL file. Total: 100 points

Transactions& Locking

1. A. Write a script that includes these statements coded as a transaction:

INSERT Orders

VALUES (3, GETDATE(), '10.00', '0.00', NULL, 4, 'American Express', '378282246310005', '04/2013', 4);

SET @OrderID = @@IDENTITY;

INSERT OrderItems

VALUES (@OrderID, 6, '415.00', '161.85', 1);

INSERT OrderItems

VALUES (@OrderID, 1, '699.00', '209.70', 1);

Here, the @@IDENTITY variable is used to get the order ID value that's automatically generated when the first INSERT statement inserts an order.

If these statements execute successfully, commit the changes. Otherwise, roll back the changes.

B. Why is it necessary to put the statements in 1A as a transaction?

C. What does it mean to commit a transaction?

2. A. Write a script to delete the row with a customer ID of 8 from the Customers table. To do this, you must first delete all addresses for that customer from the Addresses table. Place these two SQL statements in a transaction.

If these statements execute successfully, commit the changes. Otherwise, roll back the changes.

B. Explain why it is necessary to put statements involving foreign key updates such as in 2A into a transaction?

3. There are four types of concurrency problems. Explain Dirty Read and Lost Update with examples.

4. What are two ways you can prevent a deadlock in a database?

Security

5. Write a script that

A. Creates a user-defined database role named OrderEntry in the MyGuitarShop database

B. Give INSERT and UPDATE permission to the new role for Orders and OrderItems table.

C. Give SELECT permission for all user tables.

6. Write a script that

A. Creates a server login ID named "RobertHalliday" with the password "HelloBob"

B. Sets the default database for the login to the MyGuitarShop database

C. Creates a database user named "RobertHalliday" for the server login

D. Assigns the user to the OrderEntry role you created in exercise#5

7. Write a script that uses a cursor to loop through each row of the Administrators table and prints a login ID for each row in that consists of the administrator's first and last name with no space in between and a random number at the end of the login. You have to look up the function RAND and figure out how to use it.

8. Write a script that removes the user-defined database role named OrderEntry. (Hint: This script should begin by removing all users from this role.

9. In your own words, explain the following. Use specific examples if necessary.

A. Server Role

B. Database Role

Reference no: EM13760024

Questions Cloud

Analyze how quality management tools may be used : Analyze how quality management tools may be used to determine and ensure high quality within project deliverables. Provide examples with your response
Identify a relevant theoretical framework : You have learned the value and importance of identifying a relevant theoretical framework for your proposed research.
Healthcare : Research the disease(DIABETIES) and compile a bulleted list of symptoms, diagnostic procedures, progression, treatments, etc
Evaluate project metrics and testing approaches : Evaluate project metrics and testing approaches that can be used within the project management plan to validate IT project deliverables
Write a script that includes these statements coded : Write a script that includes these statements coded as a transaction. Why is it necessary to put the statements in 1A as a transaction
Description of a phenomenon or a group of phenomena : Observation and description of a phenomenon or a group of phenomena. Formulation of a hypothesis or hypotheses to explain the phenomena
Examine the literature in your readings : Examine the literature in your readings and search peer-reviewed journal articles, to analyze how the theoretical frameworks you are considering using have been used in other research
Insource or outsource the system to be developed : Suppose, as a Chief Information Officer (CIO), you were asked to provide the organization with time-entry system for the employees. Examine the options to insource or outsource the system to be developed
Advantages of using an object-oriented database : From the e-Activity, select an organization, and explain the advantages and disadvantages of using an object-oriented database and a NoSQL database in its marketplace

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Create a class named commission

Create a class named Commission that includes two numeric variables: a sales figure and a commission rate. Also create two overloaded methods name computeCommission().

  How procuring organization has sorted out problem

You are the engineer involved in development of financial system. Should you simply abandon work until procuring organization has sorted out problem?

  Creation of a base geometric class

The lab will require the creation of a base geometric class, called Shape, and two sub classes, Circle and Rectangle, that are derived public from the class Shape.

  Is it beneficial to give young children with computers

After reading information under heading Statuses, explain and provide the example of each of the following as each applies to you and your life.

  Mips assembly program

MIPS Assembly Program: Help writing this function

  Problem resolution in an organization.

In a one to two page (two page double-spaced maximum) paper explain why information systems today are currently effective or ineffective in assisting with problem resolution in an organization.

  Pipeline diagram for processor which has no forwarding

If the processor has no forwarding, how many cycles will one loop iteration take? show a pipeline diagram to support your answer.

  Computes the area of a triangle

The subsequent function computes the area of a triangle, but contains three errors. Find the errors and fix them.

  Cloud provider secure large amount of capital

Few organizations tend to prefer operating expense models. whether Cloud providers will continue to secure large amount of capital....or will equity firms stop their funding?

  Analyze faster processor chip result increase in performance

Analyze the following statement: "Using the faster processor chip results in corresponding increase in performance of a computer even if main memory speed remains same."

  Explaining power over ethernet and transfer power over fiber

A recent article in industry magazine discussed the ability to transfer Power over Ethernet (PoE) and emerging technology that is able to transfer Power over Fiber (PoF).

  Write a procedure that updates all the payment dates

Write a procedure that updates all the payment dates to the current date + 10 days for a given student (name) in the invoice table using cursors. (Will you need a schema? How do i send it to you ? do you need just the tables for the student and th..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd