Question

In: Computer Science

QUESTION 34 seqAID is a valid Oracle sequence: select seqAID.nextval from dual; the above query returns...

QUESTION 34

seqAID is a valid Oracle sequence:

select seqAID.nextval

from dual;

the above query returns 1500, what the following query will return?

Select seqAID.nextval

From dual;

A.
1499

B.
1500

C.
1501

D.
1502

QUESTION 35

after running the query in previous Question, what the following query will return?

Select seqAID.nextval-1

From dual;

A.
1499

B.
1500

C.
1501

D.
1502

QUESTION 36

after running queries in previous two Questions (34 & 35), what the following query will return?

Select seqAID.currval

From dual;

A.
1499

B.
1500

C.
1501

D.
1502

Solutions

Expert Solution

SOL:

34) The following query

Select seqAID.nextval

From dual;

Returns 1501

1501 is the correct answer

so option C is correct

Explanation:

nextval increments the sequence and returns the next value

so it is given already that the above query returns 1500

so when we execute the query in question 34 . it increments the sequence value which is 1500 . so it becomes 1501 and returns it's value

so 1501 is the correct answer

35) The query

Select seqAID.nextval-1

From dual;

it returns the value 1500

so option B is the correct answer

Explanation:

we should run the query after running the query in 34 question

The First Nextval which is executed before the query 34 returns the initial value of the sequence which is 1500.

so every subsequent nextval statement in the query executed after this increments the 1500 by 1 and returns 1501 as the answer

In query 35 after 1501 is returned we are decrementing it by 1 . so The value returned by query is 1500

36) The Query

Select seqAID.currval

From dual;

Returns 1501

so 1501 is the correct answer

so Option C is correct

Explanation:

We should execute the query after executing queries in 34 and 35

we are using curval here

curval always returns the curval of the sequence . It is the value returned by the Last refference to Next val

so The Last Nextval statement in query 35 returned 1501

so The value returned by the query in 36 also 1501

so 1501 is the answer


Related Solutions

Choose all the optional query block in “Select “retrieval query? A. Select B. Where C. From...
Choose all the optional query block in “Select “retrieval query? A. Select B. Where C. From D. Order By A NULL value means A. Value missing B. Value unknown C. More than 1000 D. All the above Delete from DEF; /*DEF is a table/relation*/ What action does this command perform? A. Delete the table B. Delete all the rows from the table C. Deletes a column D. Deletes the top 10 tuples A attribute/column, fName, is of Data Type varchar(100)....
Can you please implement this in Oracle sql Write a SELECT statement that returns one row...
Can you please implement this in Oracle sql Write a SELECT statement that returns one row for each customer that has orders with these columns: The email_address from the Customers table A count of the number of orders The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.) Return only those rows where the customer has more than 1 order. Sort the result set in descending sequence by the sum...
If the DNA sequence in the question above is at the BEGINNING of a gene, what...
If the DNA sequence in the question above is at the BEGINNING of a gene, what are the first 2 amino acids that will be joined at the ribosome? Remember there is a START codon. Use the information on this chart to answer the question. asparagine, alanine methionine, glutamine leucine, alanine alanine, lysine methionine, asparagine
From the following mySql query create a function that returns a nth value of a table:...
From the following mySql query create a function that returns a nth value of a table: SELECT name, (SUM(price * quantity)) AS TotalPrice FROM Items NATURAL JOIN Inventory GROUP BY name ORDER BY (TotalPrice) DESC LIMIT 1, OFFSET 1; Shema: Inventory(name: String,item:String,quantity:integer) Items(item: String, brand: String, price:double)
Please implement this in Oracle sql 2.) Write a SELECT statement that answers this question: What...
Please implement this in Oracle sql 2.) Write a SELECT statement that answers this question: What is the total amount ordered for each product? Return these columns: The product name from the Products table The total amount for each product in the Order_Items (Hint: You can calculate the total amount by subtracting the discount amount from the item price and then multiplying it by the quantity) Use the ROLLUP operator to include a row that gives the grand total.
1. Write a query to: a. select data from INVOICES table as follows: Invoice date in...
1. Write a query to: a. select data from INVOICES table as follows: Invoice date in MM/DD/YYYY format Invoice Date in DD-Mon-YYYY format Invoice Total rounded to the nearest dollar Note: you can alias columns as you sit fit b. select data from VENDORS table as follows: Vendor Name Concatenate Vendor Name with the string ‘s Address Concatenate Vendor City, Vendor State and Vendor Zip Code (alias this) Your output should look like this (this is just an example of...
A. Rewrite the query select * from section natural join classroom without using a natural join...
A. Rewrite the query select * from section natural join classroom without using a natural join but instead using an inner join with a using condition. B. Explain the difference between integrity constraints and authorization constraints.
would the following SQL statement returns next sunday's date? SELECT NEXT_DAY(TO_DATE('13-01-2005','DD-MM-YYYY'),'SUN') As "Date"FROM DUAL; A)  True B)  False...
would the following SQL statement returns next sunday's date? SELECT NEXT_DAY(TO_DATE('13-01-2005','DD-MM-YYYY'),'SUN') As "Date"FROM DUAL; A)  True B)  False Question 4 options: True False Question 5 (2 points) 1.  Which of the given SQL statement generate the following result? Today's date Monday ,March 2008 A) SELECT TO_CHAR(sysdate,'day,Month yyyy') "Today's date" FROM DUAL; B) SELECT TO_CHAR(sysdate,'Day,Mon yyyy') "Today's date" FROM DUAL; C) SELECT TO_CHAR(sysdate, "Day,Month yyyy ") "Today's date" FROM DUAL; D) SELECT TO_CHAR(sysdate,'Day,Month yyyy') "Today's date" FROM DUAL; Question 7 (2 points) Which of...
2. From the table above, at which worker hired do diminishing marginal returns begin?
Fill in the following blanks                        L          Q                     MP                  AP                        =============================                        0          0                    --                      --                        1          10                                           2          42                    ___                  ___                        3          62                                            ___                        4          63                    ___                       2. From the table above, at which worker hired do diminishing marginal returns begin?       
Select one of the medical terms from the CONCLUSION and DIAGNOSIS section above and define what it means.
Mr. Smith is 60 years old. He was diagnosed with a prostate cancer five years ago. Over the past few days, Mr. Smith has been feeling weak and increasingly tired and has also been suffering from a headache that did not respond to over-the-counter medications. He scheduled an appointment with his physician.His physician performed a physical examination and recommended a battery of laboratory tests and imaging procedures.The table below shows Reference values in the right-hand column. These values reflect the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT