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

  Flexibility to identify many different information systems

The case study company has provided you with the flexibility to identify many different information systems that are used by the employees. Some systems need strict access control while others should be available to everyone.

  Describe the formula for elasticity of demand

O. Describe the formula for elasticity of demand for labor as well as the significance of elastic versus inelastic findings. How does this compare with the elasticity of labor supply? P. What is the labor-leisure trade-off? On figure 8.5, describe t..

  The commonly used password management protocol

Analyze one of the commonly used password management protocol  what is the weakness of this protocol?

  Explain vulnerability in the system

How would you respond if Goli came to you describing a vulnerability in your system and offering to help fix it--What would incline you to hire her? What would disincline you from doing so?

  What interview techniques do companies employ

Watch the "Interview" video found on the student media website. What interview techniques do companies employ? From your experience, have you been in an interview when these were used? Describe the differences and the approach to being successful ..

  Describe the necessary hardware and software components

Your company wants to create an application that allows employees to dial in from a remote location and, using a single connection, access their voice mail, e-mail, and data files.

  0.4 of students are women and gpa for women

0.4 of students are women and gpa for women has mean of 3 and sd 0.8; Gpa for men has mean of 2.5 and sd of 1.0. a sample size of 100 students which consist 40 women and 60 men.

  Database administrator to define schema components

I solemnly affirm, acknowledge and certify that my responses to this examination were completed without any contact with other persons during or before the examination.

  Write a unix command to display

Write a Unix command to display, byte by byte, the contents of the file named datafile. Make sure that for each byte the character and its numerical representation are displayed.

  Merging transaction and analytical processing problem occurs

When merging transaction and analytical processing a problem occurs. Real-time analytical processing diminishes the performance of transaction processing. What is the solution to this problem that many companies use?

  Research paper tcp/ip protocol hierarchy

Write a 2 page research paper (excluding the title and reference pages) on five-layer TCP/IP protocol hierarchy. Use three other resources (Wikipedia sources are not permitted) and list each resource used at the end of the paper in the reference l..

  How to make system more user-friendly

What improvements or additions to the system do you believe would advantage you or make system more user-friendly? Why?

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