Preview

Concurrency control

Powerful Essays
Open Document
Open Document
1856 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Concurrency control
Transactions

1. In this exercise, you will see how to rollback or commit transactions. By default PostgreSQL commits each SQL statement as soon as it is submitted. To prevent the transaction from committing immediately, you have to issue a command begin; to tell PostgreSQL to not commit immediately. You can issue any number of SQL statements after this, and then either commit; to commit the transaction, or rollback; to rollback the transaction. To see the effect, execute the following commands one at a time begin ; select * from student where name = 'Tanaka';
ID Name Dept_name Tot_Cred
--------------------------------------------------
98988 Tanaka Biology 120

delete from student where name = 'Tanaka';
Query returned successfully: one row affected, 234 ms execution time.

select * from student where name = 'Tanaka';
Total query runtime: 15 ms.
0 rows retrieved.

rollback;
NOTICE: there is no transaction in progress
Query returned successfully with no result in 16 ms.

select * from student where name = 'Tanaka';
ID Name Dept_name Tot_Cred
----------------------------------------------------------------------------
98988 Tanaka Biology 120

In the above example it explains the importance of begin and rollback used together; I have shown output after performing every command. And later have explained the observation.

Observation: In the above example we are having begin command to be executed in the first line which will indicates that until we commit the update transaction the DB system won’t save the updating in the tables. In the next line we select the details of student named ‘Tanaka’ since there is no updating it will show the record ‘Tanaka’ from the student table. The next command we perform is the delete command which removes the record of student named ‘Tanaka’ from the student table so that, the student table will be updated. In the next line we again search for the student named ‘Tanaka’ from

You May Also Find These Documents Helpful

  • Satisfactory Essays

    - Any action that a database takes, creating objects, adding rows, changing data in rows, removing rows, and so on.…

    • 327 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    the first one? Because it only backed up the changes I made since the last backup. Incremental…

    • 776 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Unit 6 True

    • 287 Words
    • 1 Page

    The WHERE clause is used to set criteria by which to filter which rows are returned or affected. TRUE…

    • 287 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    CNE 251 Lab 07

    • 548 Words
    • 2 Pages

    8) There is not stdout message or error message as a result of this. Nothing was changed from the previous data.…

    • 548 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    07

    • 4772 Words
    • 25 Pages

    11) The SQL keyword MODIFY is used to change the structure, properties or constraints of a table.…

    • 4772 Words
    • 25 Pages
    Good Essays
  • Satisfactory Essays

    3. In the forward() command, what does the number argument inside the parentheses do? (1.0 points)…

    • 290 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    04

    • 4586 Words
    • 34 Pages

    The MODIFY clause is used with the ALTER TABLE command to add a PRIMARY KEY constraint to an existing table.…

    • 4586 Words
    • 34 Pages
    Satisfactory Essays
  • Good Essays

    When a group of people are different from us their way of living is wrong. That is what it seems to come down to when most conflicts in history are broken down. Men vs. women. Hippies vs. government officials. Blacks vs. whites. Jews vs., well, everyone.…

    • 583 Words
    • 2 Pages
    Good Essays
  • Better Essays

    What is a master cosmetologist? A master cosmetologist is an individual that has knowledge and skills in the field of cosmetology through advanced education. Cosmetology is defined as the art and science of beautifying and improving skin, hair, and nails. (Houghton Mifflin, 2009) In order to obtain the title master cosmetologist certain requirements must be met. A master cosmetologist may provide beauty services, massages and scalp treatments, apply make- up, style wigs, perform some hair removal and provide nail and skin care services.…

    • 1110 Words
    • 5 Pages
    Better Essays
  • Good Essays

    Vision Change Paper

    • 797 Words
    • 4 Pages

    I chose to do my change analysis paper on the Case Study from our text titled, “Role of Vision at Mentor Graphics. This company was formed in the early 1980s. Their main focus is designing a computer-aided engineering workstation product. As time has gone on this company has changed their vision. In the beginning it started out with “Build Something That People Will Buy (Palmer).” In the early 1980’s this vision was changed to “Beat Daisy (Palmer)”, due to the fact that this was a competitor that they were trying to beat out with sales. In 1985 they had accomplished this vision and needed to find a new one.…

    • 797 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    I declare that this assignment is our own work. I further declare that where material has been used from other sources, whether by paraphrasing or by direct quotation, it has been fully acknowledged and referenced. I have retained a copy of this assignment for my records.…

    • 5443 Words
    • 22 Pages
    Powerful Essays
  • Good Essays

    homework

    • 548 Words
    • 16 Pages

    Drawing on material covered in prior chapters, explain the factors to be considered in deciding whether to create a key index for a table in SQL. (Hint: there are three.)…

    • 548 Words
    • 16 Pages
    Good Essays
  • Powerful Essays

    -Communication is the activity of conveying information. Communication requires a sender, a message, and an intended recipient, although the receiver need not be present or aware of the sender's intent to communicate at the time of communication; thus communication can occur across vast…

    • 1724 Words
    • 7 Pages
    Powerful Essays
  • Good Essays

    database triggers

    • 1673 Words
    • 7 Pages

    ON orders DECLARE vMsg VARCHAR2(30) : = 'Statement Level Trigger Fired'; BEGIN IF INSERTING THEN dbms_output.put_line(vMsg || ' When Inserting'); ELSIF UPDATING THEN dbms_output.put_line(vMsg || ' When Updating'); ELSIF DELETING THEN dbms_output.put_line(vMsg || ' When Deleting'); END IF; END statement_level; / set serveroutput on INSERT INTO orders (somecolumn) VALUES ('ABC'); UPDATE orders SET somecolumn = 'DEF' WHERE ROWNUM = 1; DELETE FROM orders WHERE ROWNUM = 1; Create Row Level…

    • 1673 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    Tute 7

    • 507 Words
    • 2 Pages

    3. Consistency: Consistency is the key when entering information into a database. If a field is set to…

    • 507 Words
    • 2 Pages
    Satisfactory Essays