A Guide to SQL
A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
Expert Solution & Answer
Book Icon
Chapter 8, Problem 6SCG

Explanation of Solution

a.

Deleting query in the table “OWNER”:

Public Function Owner_Delete(I_OWNER_NUM)

    Dim strSQL As String

    strSQL = "DELETE FROM OWNER WHERE OWNER_NUM = '"

    strSQL = strSQL & I_OWNER_NUM

    strSQL = strSQL & "'"

    DoCmd.RunSQL strSQL

End Function

 Explanation:

  • Create a function named as “Owner_Delete” and pass an argument “I_OWNER_NUM”.
  • Set the strSQL string variable to “DELETE FROM OWNER WHERE OWNER_NUM = '” and make everything necessary in the command including the single quotation mark preceding the order number...

Explanation of Solution

b.

Updating query:

Public Function Owner_Update(I_OWNER_NUM, I_LAST_NAME)

    Dim strSQL As String

    strSQL = "UPDATE OWNER SET LAST_NAME = '"

    strSQL = strSQL & I_LAST_NAME

    strSQL = strSQL & "' WHERE OWNER_NUM = '"

    strSQL = strSQL & I_OWNER_NUM

    strSQL = strSQL & "'"

    DoCmd.RunSQL strSQL

End Function

 Explanation:

  • Create a function named as “Owner_Update” and pass the arguments “I_OWNER_NUM” and “I_LAST_NAME”.
  • Set the strSQL string variable to “UPDATE OWNER SET LAST_NAME = '” and make everything necessary in the command including the single quotation mark preceding the order number...

Explanation of Solution

c.

Retrieving the list in the table “CONDO_UNIT”:

Public Function Find_Condos(I_SQR_FT)

    Dim rs As New ADODB.Recordset

    Dim cnn As ADODB.Connection

    Dim strSQL As String

    Set cnn = CurrentProject.Connection

    strSQL = "SELECT LOCATION_NUM, UNIT_NUM, CONDO_FEE, OWNER_NUM FROM CONDO_UNIT WHERE SQR_FT = "

    strSQL = strSQL & I_SQR_FT

       rs.Open strSQL, cnn, adOpenStatic, , adCmdText

    Do Until rs.EOF

        Debug.Print (rs!LOCATION_NUM)

        Debug.Print (rs!UNIT_NUM)

        Debug.Print (rs!CONDO_FEE)

        Debug.Print (rs!OWNER_NUM)

        rs.MoveNext

    Loop

End Function

 Explanation:

  • Create a function named as “Find_Condos” and pass an argument “I_SQR_FT”...

Blurred answer
Students have asked these similar questions
Use My Guitar Shop Database  Use Microsoft SQL Server Write a script that includes these statements coded as a transaction: INSERT Orders VALUES (3, GETDATE(), '10.00', '0.00', NULL, 4,   'American Express', '378282246310005', '04/2019', 4);   SET @OrderID = @@IDENTITY;   INSERT OrderItems VALUES (@OrderID, 6, '415.00', '161.85', 1);   INSERT OrderItems VALUES (@OrderID, 1, '699.00', '209.70', 1); Here, the @@IDENTITY variable is used to get the order ID value that’s automatically generated when the first INSERT statement inserts an order. If these statements execute successfully, commit the changes. Otherwise, roll back the changes.
1. Create the GET_INVOICE_DATE procedure to obtain the customer ID, first and last names of the customer, and the invoice date for the invoice whose number currently is stored in I_INVOICE_NUM. Place these values in the variables I_CUST_ID, I_CUST_NAME, and I_INVOICE_DATE respectively. When the procedure is called it should output the contents of I_CUST_ID, I_CUST_NAME, and I_INVOICE_DATE. 2. Create a procedure to add a row to the INVOICES table. 3. Create the UPDATE_INVOICE procedure to change the date of the invoice whose number is stored in I_INVOICE_NUM to the date currently found in I_INVOICE_DATE
Write a stored procedure that accepts a department ID, uses BULK COLLECT to retrieve all employees in that department, and displays their first name and salary. Then write an anonymous block to run that procedure for department 100.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Text book image
Oracle 12c: SQL
Computer Science
ISBN:9781305251038
Author:Joan Casteel
Publisher:Cengage Learning