Database Systems: Design, Implementation, & Management
Database Systems: Design, Implementation, & Management
12th Edition
ISBN: 9781305627482
Author: Carlos Coronel, Steven Morris
Publisher: Cengage Learning
Question
100%
Book Icon
Chapter 10, Problem 6P

a)

Program Plan Intro

Transaction:

A transaction is a logical unit of work.

  • A sequence of process that must be completely completed or aborted.
  • Intermediate states are not acceptable in the process of transaction.
  • To make a transaction use a keyword “BEGIN TRANSACTION;”, insert SQL queries and commit the transaction.

Syntax for “TRANSACTION”:

BEGIN {TRANSACTION|TRAN};

SQL queries;

COMMIT;

“insert” query:

The INSERT command in SQL is employed to add records to an existing table. INSERT will increase the number of rows in a table.

Syntax for INSERT command:

INSERT INTO table_name VALUES (value1, value2…);

Example:

INSERT INTO employee VALUES(101, ‘Smith’,10);

“update” query:

The UPDATE command is employed to update information present in a table.

It is always used with SET keyword either in bulk or individually. UPDATE will not increase the number of rows in a table.

Syntax for UPDATE command:

UPDATE table_name SET column_name1 = value WHERE some_condition;

Example:

UPDATE employee SET name= ‘Presil’ age= 24 WHERE id=115;

b)

Explanation of Solution

Program plan:

The following SQL query is to make a customer payment for a customer “10010” of “$100” in cash using the payment ID “3428”.

  • Begin the transaction.
    • Insert the appropriate values into “payments” table using “insert” query.
    • Update the customer details to reduce the customer balance by “100” for the customer “10010” using “update” query...

Blurred answer
Students have asked these similar questions
Consider the following shorthand representation of a relational database used by a book publisher to answer the following questions.BRANCH (BRANCH_NUM, COUNTRY, NUM_EMPLOYEES) WRITER (WRITER_NUM, LAST_NAME, FIRST_NAME, BOOK_NUM) BOOK (BOOK_NUM, TITLE, TYPE, PRICE, WRITER_NUM) INVENTORY (BOOK_NUM, BRANCH_NUM, ON_HAND)2.3 List the number of employees for each branch in South Africa. 2.4 List the book code and title of each book of type “Romance”. 2.5 For each type of book list the type and the average price. 2.6 Find the title for each book written by “Bob Builder”. 2.7 List the name of all books in South Africa written by “Hans Anderson“ 2.8 Count the number of books (AS NumOfBooks) written by each author
Consider a database that consists of the following relations.SUPpLIER(Sno. Sname)PART(Pno, Pname)PROJECT(Jno, Jname)SUPPLY(Sno, Pno, Jno)The database records information about suppliers, parts, and projectsandincludes a ternary relationship between suppliers, parts, and projects.Thisrelationship is a many-many-many relationships. Specify and execute thefollowingqueries using the relational algebraRetrieve the part numbers that are supplied to exactly two projects.b. Retrieve the names of suppliers who supply more than two parts toproject J11c. Retrieve the part numbers that are supplied by every supplier.d. Retrieve the project names that are supplied by supplier S1' only.e. Retrieve the names of suppliers who supply at least two different partseach to at least two different projects.
Figure Q3.13 The Ch03_VENDINGCO database tables Table Name: BOOTH     BOOTH _PRODUCT BOOTH _PRICE Chips 1.5 Cola 1.25 Energy Drink 2 Table Name: MACHINE MACHINE _PRODUCT MACHINE _PRICE Chips 1.25 Chocolate Bar 1 Energy Drink 2 Create the table that results from applying an INTERSECT relational operator tothe tables shown in Figure Q3.13.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning