0
0
MySQLquery~10 mins

REPLACE INTO behavior in MySQL - Interactive Code Practice

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

Complete the code to insert or replace a row in the table.

MySQL
REPLACE INTO behavior (id, action) VALUES ([1], 'jump');
Drag options to blanks, or click blank then click option'
A1
B'one'
CNULL
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of a numeric id.
Using NULL which may cause insertion failure if id is primary key.
2fill in blank
medium

Complete the code to replace a row with id 5 and action 'run'.

MySQL
REPLACE INTO behavior (id, action) VALUES ([1], 'run');
Drag options to blanks, or click blank then click option'
A3
B7
C5
DNULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using an id different from 5.
Using NULL which may not replace the intended row.
3fill in blank
hard

Fix the error in the REPLACE statement to update action to 'walk' for id 10.

MySQL
REPLACE INTO behavior (id, action) VALUES ([1], 'walk');
Drag options to blanks, or click blank then click option'
A'10'
BNULL
Cid
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numeric id.
Using NULL which may cause insertion failure.
4fill in blank
hard

Fill both blanks to replace a row with id 20 and action 'sit'.

MySQL
REPLACE INTO behavior ([1], [2]) VALUES (20, 'sit');
Drag options to blanks, or click blank then click option'
Aid
Baction
Cname
Ddate
Attempts:
3 left
💡 Hint
Common Mistakes
Using columns that don't match the values.
Swapping the order of columns.
5fill in blank
hard

Fill all three blanks to replace a row with id 30, action 'jump', and date '2024-01-01'.

MySQL
REPLACE INTO behavior ([1], [2], [3]) VALUES (30, 'jump', '2024-01-01');
Drag options to blanks, or click blank then click option'
Aid
Baction
Cdate
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using columns that don't match the values.
Including a column not in the values.