Write an equivalent query in the relational algebra

Assignment Help Basic Computer Science
Reference no: EM131064836

When tuning SQL code, use the following tools. (must be done on oracle express, and include a separate word document with the SQL statements. Include sql file and word document at the end please)

The following settings turn on the execution plan output.

SET AUTOTRACE ON;
SET SERVEROUTPUT ON;
SET TIMING ON;
Set AUTOTRACE to TRACEONLY for queries with voluminous output.
This query lists the current indexes.

SELECT c.index_name, c.table_name, c.column_name, i.index_type

FROM User_Ind_Columns c, User_Indexes i
WHERE c.index_name = i.index_name;
The index types are all set to "normal", the default B-tree; OracleXE doesn't support bitmapped indexes. You can deactivate/activate the indexes using the following command.
ALTER INDEX indexName [INVISIBLE, VISIBLE];
You can create/drop indexes using the following commands.
[CREATE, DROP] INDEX IndexName ON Tablename(fieldList);
You can execute code multiple times using the following anonymous code block.

DECLARE
dummy INTEGER;
BEGIN
FOR i IN 1..1000 LOOP
YourSelectCommand;
END LOOP;
END;
/

With this rather large database in place and these helpful tools, do the following exercises.

Exercise 4.1

Create a view that for the CPDB "birthday czar", which includes each person's full name, age (using

TRUNC(MONTHS_BETWEEN(SYSDATE, birthdate)/12) ) and birthdate (only), and then try the following.

Retrieve the GenX people from the database (i.e., those born from 1961-1975);

Update the Person base table to include a GenX birthdate for some person who had a NULL birthdate before and then re-run your query on the view from the previous question. Do the results of the view query change? Why or why not?

Try to insert a new person using your new view. If this doesn't work, explain (but do not implement) the modifications you'd have to make to your view so that it does. Be sure that you understand what is required for a view to be updateable and what happens to the fields of the inserted record in the base table not included in the view.

DROP your new view - does this affect your base tables in any way?

Exercise 4.2

Do the following for the query on which the view in the previous exercises is based.

Write an equivalent query in the relational algebra

Reference no: EM131064836

Questions Cloud

In a survey of students at a local college : In a survey of students at a local college it was decided to give part-time students twice the chance of selection because of the smaller numbers involved and the diversity of their study patterns.
Firm has a debt issue outstanding : Drogo, Inc., is trying to determine its cost of debt. The firm has a debt issue outstanding with 16 years to maturity that is quoted at 105 percent of face value. The issue makes semiannual payments and has an embedded cost of 10 percent annually. Wh..
Calculate the p-value of the observed sample proportion : State an appropriate null hypothesis and alternative hypothesis for her to consider as the framework for a one-proportion z-test. Calculate the p-value of the observed sample proportion
What is the price of the bill as a percentage of face value : A Treasury bill purchased in December 2015 has 140 days until maturity and a bank discount yield of 1.87 percent. Assume a $100 face value. What is the price of the bill as a percentage of face value?
Write an equivalent query in the relational algebra : Write an equivalent query in the relational algebra
Change the health and doctor-vising habits of individuals : HSAs are gaining in popularity as employers and insurers see them as viable options for shifting the cost of care back to patients. Do you believe that HDHP/HSA plans will change the health and doctor-vising habits of individuals? What about people's..
What is the portfolio expected return : Consider the following information about three stocks: State of Probability of Rate of Return if State Occurs Economy State of Economy Stock A Stock B Stock C Boom 0.3 0.2 0.25 0.60 Normal 0.45 0.15 0.11 0.05 Bust 0.25 0.01 -0.15 -0.50 a. What are th..
Why is self-awareness important for being a good manager : Why is self-awareness important for being a good manager? Describe some negative consequences that might result from a manager with low self-awareness.
Confidence interval for the average number of chips : Create a 95% confidence interval for the average number of chips. Is your confidence interval at all consistent with Nabisco's advertising claim, or does it make it seem unlikely

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Ways to send these postcards to friends

There are k types of postcards, each with limited amount. Let there be ai copies of i-th postcard. How many ways are there to send these postcards to n friends?

  Explain in detail why you believe the risk management

For each of the three (3) or more malicious attacks and / or threats that you identified in Assignment 1, choose a strategy for addressing the associated risk (i.e., risk mitigation, risk assignment, risk acceptance, or risk avoidance). Explain yo..

  Best practices for developing a universally usable interface

Best practices for developing a universally usable interface.

  What is e-waste

1. What is e-waste? What is so dangerous about e-waste? Many well-meaning individuals thought that recycling was the answer to the e-waste problem. But why hasn't e-waste recycling yielded the results hoped for?

  Analyze the overall attributes of symmetric and asymmetric

"Cryptography"  Please respond to the following: Analyze the overall attributes of symmetric and asymmetric cryptography technologies. Discuss the advantages and disadvantages of each, and speculate upon the main reasons why organizations utilize bot..

  What is a front end/back end db

What is a front end/back end DB?.

  Identify all related tasks and resources

Identify all related tasks and resources needed to complete the scenario.

  Finding and fixing errors in programs

Finding and fixing errors in programs.Finding and fixing errors in programs.

  A database command defining a table expressed

A database command defining a table expressed using the five database operators

  Wrtie an alter table statement that adds two new check

Wrtie an Alter Table statement that adds two new check constraints to the invoices table of the ap database.

  Find standard deviations

A small bank that heretofore did not use a scorecard wanted to determine whether a score-card would be advantageous.  find standard deviations.

  Wouldn''t the server already know its name

Why does the HTTP GET command on page 654, GET http://www.cs.princeton.edu/index.html HTTP/1.1 contain the name of the server being contacted? Wouldn't the server already know its name? Use Telnet, as in Exercise 14, to connect to port 80 of an HT..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd