Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment #6 Question 1 Given the first SQL DML statement below, determine the

ID: 3828523 • Letter: A

Question

Assignment #6

Question 1

Given the first SQL DML statement below, determine the result after the execution of each of the succeeding SQL DML statements. (100 pints)

SQL Statement

RESULT

DNO

DNAME

DPOP

DLEVEL

SELECT *

FROM BUSINESS_DISTRICT;

1314

LUSAKA

240000

4

1415

NAIROBI

120000

3

1617

ACCRA

160000

1

DELETE BUSINESS_DISTRICT

WHERE DLEVEL <= 3;

SELECT *

FROM BUSINESS_DISTRICT;

ROLLBACK;

DELETE BUSINESS_DISTRICT

WHERE DLEVEL >= 3;

COMMIT;

ROLLBACK;

SELECT *

FROM BUSINESS_DISTRICT;

SQL Statement

RESULT

DNO

DNAME

DPOP

DLEVEL

SELECT *

FROM BUSINESS_DISTRICT;

1314

LUSAKA

240000

4

1415

NAIROBI

120000

3

1617

ACCRA

160000

1

DELETE BUSINESS_DISTRICT

WHERE DLEVEL <= 3;

SELECT *

FROM BUSINESS_DISTRICT;

ROLLBACK;

DELETE BUSINESS_DISTRICT

WHERE DLEVEL >= 3;

COMMIT;

ROLLBACK;

SELECT *

FROM BUSINESS_DISTRICT;

Explanation / Answer

2. Upon execution of this statement you will get
   '2 rows deleted'
  
3. Since two rows are deleted, result will be
   1314       LUSAKA       240000       4
  
4. Upon execution of this statement we will see
   'Rollback complete'
   So, we again have all 3 rows in the database

5. Upon execution of this statement we will see
   '2 rows deleted'
  
6. We will see
   'Commit complete'
   So, we now have only one row left in the db
  
  
7. 'Rollback complete'
   Since there was no pending transaction, nothing will be effected
  
8. We will see the only record left in the db
   1617       ACCRA       160000       1