Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Accounts acctNo owner userid password balance 365556 Tony Jones tjones 456 819.3

ID: 3714258 • Letter: A

Question

Accounts

acctNo

owner

userid

password

balance

365556

Tony Jones

tjones

456

819.37

499872

Frank Smith

fsmith

123

590.81

761112

George Powers

gpowers

geo

239.41

765552

Betty Davis

bdavis

atl

356.21

872221

Suzanne Austin

suze

suze

622.22

899900

Mary Wilson

mwilson

mary

772.12

Customers

cid

cName

cAddr

cPhone

cEmail

tjones

Tony Jones

Miami, Fl

514-999-2131

tjones@yahoo.com

fsmith

Frank Smith

Dallas, Tx

616-423-1717

fsmith@haotmail.com

gpowers

George Powers

Chicago, Il

612-901-2312

gpowers@bellsouth.net

bdavis

Betty Davis

Nashville, Tn

909-367-9485

bdavis@yahoo.com

suze

Suzzane Austin

San Diego, Ca

201-565-1902

suze@yahoo.com

mwilson

Mary Wilson

Atlanta, Ga

405-787-2911

mwilson@hotmail.com

Write an “Update” statement that will change the cName for “suze” in the Customers table to match the owner in the Accounts table(Use a SubQuery)

Accounts

acctNo

owner

userid

password

balance

365556

Tony Jones

tjones

456

819.37

499872

Frank Smith

fsmith

123

590.81

761112

George Powers

gpowers

geo

239.41

765552

Betty Davis

bdavis

atl

356.21

872221

Suzanne Austin

suze

suze

622.22

899900

Mary Wilson

mwilson

mary

772.12

Explanation / Answer

Question :-

We have to update cName in Customers for cid = 'suze' same as in table Accounts for userid ='suze'.

As we can see that in Accounts table owner ='Suzanne Austin' for userid ='suze' but in Customers for cid = 'suze' ,cName ='Suzzane Austin' .

as there is an extra 'z' for 'Suzzane' in cName which differ from 'Suzane' in owner, so we are updating cName in Customers.

answer :-

UPDATE Customers SET cName = (SELECT owner FROM Accounts WHERE userid='suze') WHERE cid='suze' ;