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”...
Trending nowThis is a popular solution!
Chapter 8 Solutions
A Guide to SQL
- Hint: The top organizational count is 536. Submit You do not need to export or convert the database - simply upload the .sqlite file that your program creates. See the example code for the use of the connect() statement. Counting Organizations This application will read the mailbox data (mbox.txt) and count the number of email messages per organization (i.e. domain name of the email address) using a database with the following schema to maintain the counts. CREATE TABLE Counts (org TEXT, count INTEGER) When you have run the program on mbox.txt upload the resulting database file above for grading. If you run the program multiple times in testing or with dfferent files, make sure to empty out the data before each run. You can use this code as a starting point for your application: http://www.py4e.com/code3/emaildb.pyZ. The data file for this application is the same as in previous assignments: http://www.py4e.com/code3/mbox.txt Z. Because the sample code is using an UPDATE statement and…arrow_forward1. 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_DATEarrow_forwardCreate a stored procedure that will return the number of customers in a given state. The parameter for your stored procedure should accept the state abbreviation ('UT') and return the results of a query that returns the number of customers in that state.arrow_forward
- Below are some rows of the table INVOICE COD PROV_COD DATE TYPE LOC TOTAL 2910 192 2022-03-11 90 TX 1928 9301 384 2022-05-03 90 NY 2800 Overdue invoices are those whose date plus TYPE days have passed. Which of the following shows all invoices with overdue dates? a. SELECT * FROM INVOICE WHERE CURDATE() - DATE > TYPE b. SELECT * FROM INVOICE WHERE CURDATE()-TYPE >DATE c. SELECT * FROM INVOICE WHERE DATE+TYPE < CURDATE() d. SELECT * FROM INVOICE WHERE DATE+TYPE > CURDATE()arrow_forwardCreate a function in your own database that takes two parameters: A year parameter A month parameter The function then calculates and returns the total sales of the requested period for each territory. Include the territory id, territory name, and total sales dollar amount in the returned data. Format the total sales as an integer. Hints: a) Use the TotalDue column of the Sales.SalesOrderHeader table in an AdventureWorks database for calculating the total sale. b) The year and month parameters should have the SMALLINT data type.arrow_forwardINFO 2303 Database Programming Assignment : PL/SQL Practice Note: PL/SQL can be executed in SQL*Plus or SQL Developer or Oracle Live SQL. Write an anonymous block to retrieve the doctor’s ID and name which in charge of certain patient. Allow the user to enter the patient’s ID.arrow_forward
- Do this in MySQL please: Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX.arrow_forwardDO THIS IN MYSQL PLEASE! Question: Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX.arrow_forwardDO THIS IN MYSQL PLEASE! Question: Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX.arrow_forward
- T-SQL procedure for MICROSOFT SQL SERVER A: obtain the name and credit limit of the customer whose number currently is stored in I_CUSTOMER_NUM. Place these values in the variables I_CUSTOMER_NAME and I_CREDIT_LIMIT, respectively. Output the content of I_CUSTOMER_NAME and I_CREDIT_LIMIT. HINT use cursor instructions as a template for the problem. Instructions goes as follows CREATE PROCEDURE usp_DISP_REP_CUST @repnum char(2) AS DECLARE@custnum char(3) DECLARE@custname char(35) DECLARE mycursor CURSOR READ_ONLY FOR SELECT CUSTOMER_NUM, CUSTOMER_NAME FROM CUSTOMER WHERE REP_NUM = @repnum OPEN mycursor FETCH NEXT FROM mycursor INTO @custnum, @custname WHILE @@FETCH_STATUS=0 BEGIN PRINT@custnum+' '+@custname FETCH NEXT FROM mycursor INTO @custnum, @custname END CLOSE mycursor DEALLOCATE mycursorarrow_forwardUse 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.arrow_forward20 - final question Assuming you have designed a PhoneBook application; O Form1 name Insert Delete export clear All surname phone number load Data Close Update Туре The phoneBook connects to database called phonebook created in SQLExpress. When "clear All" button is clicked all data in textboxes is cleared, data grid (dataGridView1) is cleared and type combobox (comboBox1) should not have any selection. In order to clear combobocx selection the correct statement is: a. comboBox1. SelectedValue = -1; b. comboBox1. Enabled = false; C. comboBox1. Equals = -1arrow_forward
- A Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology PtrProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage