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

SQL ORACLE QUESTION How write a statement to add a new Credit Card for yourself

ID: 3848983 • Letter: S

Question

SQL ORACLE QUESTION

How write a statement to add a new Credit Card for yourself (using the @@IDENTITY value for the FK Guest ID Number that was issued when you did query #1).

CreditCardID Guest ID CCType CCNumber CCCompany CCCardHolder CCExpiration 1500 AMEX 123456789012345 NULL Anita Proul 2018-09-30 00:00:00 Anita Proul 1500 VISA 1234567890123450 BYU 2018-11-30 00:00:00 3 3 1500 VISA 8887776665551110 NULL Anita Proul 2018-09-30 00:00:00 4 1501 MCARD 8574820349202020 NULL Ted Cowan 2018-08-31 00:00:00 5 1502 VISA 4949676734341210 NULL Greg Anderson 2018-09-30 00:00:00 6 1502 DISC 4959039448278280 NULL Greg Anderson 2018-09-30 00:00:00 7 7 1503 DISC 409395034903459 NULL 2018-05-31 00:00:00 Rob Hilton 8 8 1504 AMEX 949494949494944 Attic Circle Bradley B. Peterson 2018-01-31 00:00 00 Shawn O'Brien 2018-10-31 00:00:00 1505 AMEX 494595503953049 NULL 2018-12-31 00:00:00 Sean O'Brien 10 10 1505 AMEX 494958584949444. NULL

Explanation / Answer

Hi, Am not clear with your question. Do you want me to write a query to insert data into CREDITCARD table with Guestid of 1506?? Please respond.

Here, Am writing a query to insert new record to GUEST table and CREDITCARD table at once with guest id as 1506.

This query will insert data into both GUEST table and CREDITCARD table. If this is not your requirement please mention your requirement clearly.

QUERY :

INSERT ALL INTO GUEST (GuestID,GuestFirst,GuestLast,GuestAddress1,GuestAddress2,GuestCity,GuestState,GuestPostalCode,GuestCountry,GuestPhone,GuestEmail,GuestComments) values (1506,'xxx','yyy','address1','address2','city','state','postalc ode','country','phone','email','comments') INTO CREDITCARD (CreditCardId,GuestId,CCType,CCNumber,CCCompany,CCCardHolder,CCExpiration) values (11,1506,'VISA',12345678,'Company','Holder Name',2018-12-31 00:00:00) SELECT * FROM dual;