72.4k views
5 votes
Based on the tables below, which of the following SQL statements would increase the balance of the Gonzales account by 100 to a total of 450?

1) SELECT Gonzales
FROM CUSTOMER
INSERT VALUES PLUS (100) INTO Balance;
2) SELECT Gonzales
FROM CUSTOMER
INSERT VALUES (450) INTO Balance;
3) INSERT INTO CUSTOMER VALUES PLUS (100)
SELECT Balance
WHERE CustName = 'Gonzales';
4) INSERT INTO CUSTOMER VALUES (450)
SELECT Balance
WHERE CustName = 'Gonzales';
5) UPDATE CUSTOMER
SET Balance = 450
WHERE CustName = 'Gonzales';

1 Answer

1 vote

Final answer:

The correct SQL statement to increase the balance of the Gonzales account by 100 to a new balance of 450 is: UPDATE CUSTOMER SET Balance = 450 WHERE CustName = 'Gonzales'. This updates the Gonzales' balance to the new value in the CUSTOMER table.

Step-by-step explanation:

The correct SQL statement to increase the balance of the Gonzales account by 100 to a total of 450 is:

5) UPDATE CUSTOMER SET Balance = 450 WHERE CustName = 'Gonzales';

This command specifies that we should apply an update to the CUSTOMER table where the CustName is 'Gonzales'. The SET clause is used to modify the Balance column to the new value of 450. The WHERE clause ensures that only the record for 'Gonzales' is modified. This is the only correct and valid SQL statement that accomplishes the task as specified.

It's important to note that INSERT INTO is used for adding new records, not updating existing ones, and SELECT is used for retrieving data from the database, not modifying it.

User Josh Bedo
by
8.6k points