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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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