NEW
Font size
WorksheetsTransaction and Stored Procedure
Total questions: 20
Worksheet time: 7mins
1. What is the primary key of the product table?
quantity
Productname
price
productid
2. Which table records the number of items sold?
salesreport
product
productsale
inventory
3. What does the COMMIT command do?
Cancels all changes
Saves all changes permanently
Starts a new transaction
Checks for errors
4. What is the purpose of ROLLBACK?
Save changes
Start a transaction
Undo changes
Insert data
5. Which SQL command begins a transaction?
BEGIN
START TRANSACTION
OPEN
INITIATE
If productid 103 has quantity 200 and 30 units are sold, what is the new quantity?
230
170
200
180
7. Which field in productsale links to the product table?
productsaleid
quantitysold
productid
name
8. What type of key is productsaleid?
Primary key
Foreign key
Composite key
Alternate key
9. What happens if you forget to COMMIT a transaction?
Changes are saved
Changes are lost
Database crashes
New table is created
10. Which clause is used to join product and productsale?
JOIN
CONNECT
LINK
MERGE
11. What does UPDATE product SET quantity = quantity - 2 do?
Deducts 2 units
Adds 2 units
Deletes the product
Sets quantity to 2
12. Which data type is best for price?
VARCHAR
INT
DECIMAL
TEXT
13. What does SELECT * FROM product return?
Only product names
All columns and rows
Only prices
Only productid
14. Which command adds a new sale?
INSERT
UPDATE
DELETE
SELECT
15. What is the result of ROLLBACK after an INSERT?
Record is saved
Record is deleted
Record is ignored
Record is undone
16. What does WHERE productid = 104 do?
Filters for product 104
Deletes product 104
Updates all products
Joins tables
17. What is the role of a stored procedure?
Backup database
Create tables
Automate SQL logic
Store images
18. Which command changes existing data?
INSERT
SELECT
UPDATE
CREATE
19. What does FOREIGN KEY (productid) do in productsale?
Creates a new table
Links to product table
Deletes duplicates
Adds a primary key
20. What happens if quantitysold is greater than quantity?
Quantity becomes negative
Sale is rejected
Product is deleted
Sale is ignored
