wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Transaction and Stored Procedure

Total questions: 20

Worksheet time: 7mins

Name
Class
Date
1.

1. What is the primary key of the product table?

a)
  • quantity

b)
  • Productname

c)
  • price

d)
  • productid

2.

2. Which table records the number of items sold?

a)
  • salesreport

b)
  • product

c)
  • productsale

d)
  • inventory

3.

3. What does the COMMIT command do?

a)
  • Cancels all changes

b)
  • Saves all changes permanently

c)
  • Starts a new transaction

d)
  • Checks for errors

4.

4. What is the purpose of ROLLBACK?

a)
  • Save changes

b)
  • Start a transaction

c)
  • Undo changes

d)
  • Insert data

5.

5. Which SQL command begins a transaction?

a)
  • BEGIN

b)
  • START TRANSACTION

c)
  • OPEN

d)
  • INITIATE

6.

If productid 103 has quantity 200 and 30 units are sold, what is the new quantity?

a)
  • 230

b)
  • 170

c)
  • 200

d)
  • 180

7.

7. Which field in productsale links to the product table?

a)
  • productsaleid

b)
  • quantitysold

c)
  • productid

d)
  • name

8.

8. What type of key is productsaleid?

a)
  • Primary key

b)
  • Foreign key

c)
  • Composite key

d)
  • Alternate key

9.

9. What happens if you forget to COMMIT a transaction?

a)
  • Changes are saved

b)
  • Changes are lost

c)
  • Database crashes

d)
  • New table is created

10.

10. Which clause is used to join product and productsale?

a)
  • JOIN

b)
  • CONNECT

c)
  • LINK

d)
  • MERGE

11.

11. What does UPDATE product SET quantity = quantity - 2 do?

a)
  • Deducts 2 units

b)
  • Adds 2 units

c)
  • Deletes the product

d)
  • Sets quantity to 2

12.

12. Which data type is best for price?

a)
  • VARCHAR

b)
  • INT

c)
  • DECIMAL

d)
  • TEXT

13.

13. What does SELECT * FROM product return?

a)
  • Only product names

b)
  • All columns and rows

c)
  • Only prices

d)
  • Only productid

14.

14. Which command adds a new sale?

a)
  • INSERT

b)
  • UPDATE

c)
  • DELETE

d)
  • SELECT

15.

15. What is the result of ROLLBACK after an INSERT?

a)
  • Record is saved

b)
  • Record is deleted

c)
  • Record is ignored

d)
  • Record is undone

16.

16. What does WHERE productid = 104 do?

a)
  • Filters for product 104

b)
  • Deletes product 104

c)
  • Updates all products

d)
  • Joins tables

17.

17. What is the role of a stored procedure?

a)
  • Backup database

b)
  • Create tables

c)
  • Automate SQL logic

d)
  • Store images

18.

18. Which command changes existing data?

a)
  • INSERT

b)
  • SELECT

c)
  • UPDATE

d)
  • CREATE

19.

19. What does FOREIGN KEY (productid) do in productsale?

a)
  • Creates a new table

b)
  • Links to product table

c)
  • Deletes duplicates

d)
  • Adds a primary key

20.

20. What happens if quantitysold is greater than quantity?

a)
  • Quantity becomes negative

b)
  • Sale is rejected

c)
  • Product is deleted

d)
  • Sale is ignored