Database Systems: Design, Implementation, & Management
Database Systems: Design, Implementation, & Management
13th Edition
ISBN: 9781337627900
Author: Carlos Coronel, Steven Morris
Publisher: Cengage Learning
Question
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 table in a relational database.Last Name Rank Room ShiftSmith Manager 234 MorningJones Custodian 33 AfternoonSmith Custodian 33 EveningDoe Clerical 222 MorningAccording to the data shown in the table, which of the following could be candidate keys of the table?a) {Last Name}b) {Room}c) {Shift}d) {Rank, Room}e) {Room, Shift}
The relational schema shown below is part of a hospital database. The primary keys are highlighted in bold. Patient (patientNo, patName, patAddr, DOB)Ward (wardNo, wardName, wardType, noOfBeds)Contains (patientNo, wardNo, admissionDate)Drug (drugNo, drugName, costPerUnit)Prescribed (patientNo, drugNo, unitsPerDay, startDate, finishDate)   for CONTAINS nad PRESCRIBED table , which one is primary key and how to create table ?
ABC Markets sell products to customers. The relational diagram shown in Figure P10.6 represents the main entities for ABC's database. Note the following important characteristics: A customer may make many purchases, each one represented by an invoice. The CUS_BALANCE is updated with each credit purchase or payment and represents the amount the customer owes. The CUS_BALANCE is increased (+) with every credit purchase and decreased (–) with every customer payment. The date of last purchase is updated with each new purchase made by the customer. The date of last payment is updated with each new payment made by the customer. An invoice represents a product purchase by a customer. An INVOICE can have many invoice LINEs, one for each product purchased. The INV_TOTAL represents the total cost of the invoice, including taxes. The INV_TERMS can be "30," "60," or "90" (representing the number of days of credit) or "CASH," "CHECK," or "CC." The invoice status can be "OPEN," "PAID," or "CANCEL."…
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
Text book image
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr