Write SQL commands to execute the following requests and write commands to verif
ID: 3586110 • Letter: W
Question
Write SQL commands to execute the following requests and write commands to verify that the command was executed correctly.
Add a new row in the orders table with the following data: Order# = 1021, Customer# = 1009, order date = July 20, 2009
Modify the zip code on order 1017 to 33222
Save the changes permanently to the database
Add a new row in the orders table with the following data: Order# = 1022, customer# = 2000, order date = august 6, 2009
Add a new row in the orders table with the following data: order# = 1023, customer# = 1009, describe the error raised and what caused the error
Create a script using substitution variables that allows a user to set a new cost amount for a book based on the ISBN
Execute the script and set the following values: ISBN = 1059831198 and cost = $20.00
Execute a command that undoes the change in step 7
Delete order #1005. You need to address the master order record and the related detail records.
Execute a command that undoes the previous deletion.
Create a sequence for populating the customer# column of the customers table. When setting the start increment values, keep in mind that data already exists in the table. The options should be set to not cycle the values and not cache any values, and no minimum or maximum values should be declared
Add a new customer row by using the sequence created in Question 1. The only data currently available for the customer is as follows: last name = shoulders, first name = frank, and zip 23567.
Create a sequence that generates integers starting with the value 5. Each value should be three less than the previous value generated. The lowest possible value should be 0, and the sequence shouldn’t be allowed to cycle. Name the sequence MY_FIRST_SEQ.
Issue a select statement that displays nextval, or my_first_seq three times. Because the value isn’t being placed in a table, use the dual table in the FROM clause of the SLECT statement. What causes the error on the third SELECT?
Change the setting of MY_FIRST_SEQ so that the minimum value that can be generated is -1000
A new table has been requested to support tracking automated emails sent to customers create a table and add data as described below:
Table name: email_lob
Columns: emailed(numeric), emaildate(datetime), customer# (numeric)
Primary Key: emailed column define as an identity column
Add the following data rows and displayed resulted rows (if any errors occur, explain why the error is expected)
i.Emaildate = current date, customer# = 1007
ii.Emailid = specify to use the column default value, emaildate = current date, customer# = 1008
iii.Emailid = 25, emaildate = current date, customer# = 1009
Create a private synonym that enables you to reference the MY_FIRST_SEQ object as NUMGEN
Use a Select statement to view the CURRVAL of NUMGEN. Delete the NUMGEN synonym and MY_FIST_SEQ
Create a bitmap index on the CUSTOMERS table to speed up queries that search for customers based on their stat of residence. Verify that the index exists and then delete the index
Create a B-tree index on customers last name column. Verify that the index exists by querying the data dictionary. Remove the index from the database
Many queries search by the number of days to ship (number of days between the order and shipping dates). Create an index that might improve the performance of these queries.
Explanation / Answer
Below are the requested sql queries. According to Chegg policy I am answering the 4 parts of your solution. To get the remaining answered please post a new question with numbering.
To save changes permanently use commit.
If the above query executed then it gives error as primary key violation because 1009 is already in the table order.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.