0
0
PostgreSQLquery~10 mins

Read committed behavior in PostgreSQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a transaction with read committed isolation level in PostgreSQL.

PostgreSQL
BEGIN TRANSACTION ISOLATION LEVEL [1];
Drag options to blanks, or click blank then click option'
Aread committed
Bserializable
Crepeatable read
Dread uncommitted
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'read uncommitted' which is not supported in PostgreSQL.
Confusing 'repeatable read' with 'read committed'.
2fill in blank
medium

Complete the SQL query to select data inside a read committed transaction.

PostgreSQL
BEGIN TRANSACTION ISOLATION LEVEL read committed; SELECT * FROM [1]; COMMIT;
Drag options to blanks, or click blank then click option'
Ausers
Btransactions
Corders
Dproducts
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a table name that does not exist in the database.
Forgetting to commit the transaction.
3fill in blank
hard

Fix the error in the transaction isolation level syntax.

PostgreSQL
BEGIN TRANSACTION ISOLATION [1] read committed;
Drag options to blanks, or click blank then click option'
AAT
BLEVEL
CWITH
DON
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'WITH' or 'ON' which are invalid here.
Omitting the keyword entirely.
4fill in blank
hard

Fill both blanks to create a query that reads only committed data and avoids dirty reads.

PostgreSQL
SET TRANSACTION ISOLATION LEVEL [1]; SELECT * FROM [2] WHERE status = 'active';
Drag options to blanks, or click blank then click option'
ALEVEL
Bread committed
Cusers
Dorders
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the blanks or using wrong keywords.
Using a table name that does not exist.
5fill in blank
hard

Fill all three blanks to write a transaction that sets read committed isolation, updates a table, and commits.

PostgreSQL
BEGIN TRANSACTION ISOLATION LEVEL [1]; UPDATE [2] SET status = 'completed' WHERE id = [3]; COMMIT;
Drag options to blanks, or click blank then click option'
Aread committed
Btasks
C42
Dserializable
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'serializable' instead of 'read committed' for this example.
Forgetting to commit the transaction.
Using a non-numeric id value.