Question

In: Computer Science

What is an Inner joins vs. outer joins? What is a Natural Join vs. Cross join?...

  1. What is an Inner joins vs. outer joins?
  2. What is a Natural Join vs. Cross join?
  3. What is a Subquery?

4, What is a Transaction? Show an example.

5. What is a purpose of Lock Manager when a RDBMS processes transactions?

Solutions

Expert Solution

As per rules, i can answer 4 sub-parts. If this answer is helpful plz upvote.

Inner join vs outer join -

Inner join - it creates new table by joining column values of two tables. Basically, inner join is the intersection of two tables. It links two tables based on a common value. It shows the data that exists in both tables.

How to join :

Use a keyword called JOIN

After the first table in the FROM clause

Add second table, then specify the columns

SELECT... FROM tableA

JOIN tableB ON tableA.col=tableB.col

Use INNER JOIN or JOIN

INNER is optional

Same values-

Columns need to refer to the same concept

E.g, department ID in both tables

Dont join the employee ID to the department ID:different concepts

After joining :

Then select columns from both tables.

Syntax:

SELECT table 1.column1,table2.column2...

FROM table1

INNER JOIN Table2

On table 1.common_field=table2.common_field;

Outer join - An outer joins returns all rows from one of the tables, along with matching information from another table.

Left outer join -it keeps every tuple in the first or left relation.

Syntax: SELECT columns FROM table1 LEFT[outer] JOIN table2 ON table1.column=table2

Right outer join - it keeps every tuple in the second or right relation.

Syntax: SELECT column-names. FROM table-name1 RIGHT OUTER JOIN table-name2.ONcolumn-name1=column-name2 WHERE condition

Full join - it keeps tuples from both left and right relation.

syntax is:

SELECT table1. Column1, table2. Column2..

FROM table 1

FULL JOIN table2

ON table1. Common_field =table2. Common_field ;

Natural vs cross join-

Natural join -

Natural join joins two tables based on same attribute name and datatypes. It selects rows from the two tables that have equal values in all matched columns.

Syntax:

SELECT *FROM

Tablename1 NATURAL JOIN tablename2;

Cross join-

Cross join is used to combine each row of the first table with each row of the second table.it is also called Cartesian product.

Syntax:

SELECT [colmn names]

FROM [table 1]

CROSS JOIN [table2]

Subquery- A subquery is a query within another SQL query. (inner query or a nested query)

The result returned by the inner query will be used as an input to outer query. We can use comparative operators in queries.

Types of subquery :

Single row subquery

Multiple row subquery

Multiple column subquery

Corelated subqueries

Nested subqueries

The sub query can be nested inside a INSERT statement, DELETE statement, SELECT statement, UPDATE statement.

4.Transaction - It is a program unit whose execution may change the content of database.it is a exchange of information in database. It can manipulate methods itself. Transaction is the major part of our lifestyle as banking system, financial system depends on transaction system.

Example-

company takes out a loan.

Sales of goods, finance and services for cash or credit.

Purchasing of goods through credit cards.


Related Solutions

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.
1.Define each of the following terms : a. base table b. equi-join c. outer join 2.What...
1.Define each of the following terms : a. base table b. equi-join c. outer join 2.What are the key new features of SQL introduced in SQL;2016 ? 3.Write the SQL command to add column DAILY GRADE to a table called STUDENT table.
Give an example of an inner and outer class. (Java)
Give an example of an inner and outer class. (Java)
What is the relevance of the outer game and the inner game on your leadership behavior?...
What is the relevance of the outer game and the inner game on your leadership behavior? What points of leverage and strategies are given for increasing motivation and employee satisfaction? What variables affect motivation and satisfaction? Why?
3. Assume an annulus of inner radius r1 and outer radius r2. The inner surface is...
3. Assume an annulus of inner radius r1 and outer radius r2. The inner surface is at T1, the outer surface at T2, T1 > T2. Assume heat transfer between the surfaces by conduction, with a variable conductivity, k = a + bT, develop an expression for the temperature in the material of the annulus.
The outer and inner boundaires of prandtl stress potential functions have what restrictions
The outer and inner boundaires of prandtl stress potential functions have what restrictions
What are disadvantages associated with muscles that cross more than one join
What are disadvantages associated with muscles that cross more than one join
A hollow, conducting sphere with an outer radius of .250 m and an inner radius of...
A hollow, conducting sphere with an outer radius of .250 m and an inner radius of .200 m has a uniform surface charge density of -6.37 muC/me2.When a charge is now introduced at the center of the cavity inside the sphere, the new charge density on the outside of the sphere is -4.46 muC/me2. What is the charge at the center of the cavity?
A potential difference of V0 is maintained between the inner and outer conductor of a coaxial...
A potential difference of V0 is maintained between the inner and outer conductor of a coaxial cable of length L, inner conductor radius a, and outer conductor radius b. (a) Calculate the current through the medium (∈,σ) using the analogy of ?⃗ and ?⃗⃗⃗. (b) Now, assume that V0 = 500 V, L = 50 m, a = 2 cm and b = 6 cm, and the relative permittivity and the conductivity of the medium are ∈?=3 and σ=5 μS/m,...
A short and hollow cylindrical bar, having an outer diameter of 4.00 in and an inner...
A short and hollow cylindrical bar, having an outer diameter of 4.00 in and an inner diameter of 7 in, is subjected to two simultaneous loads - an axial compressive force of 75,100 lb. and a torsional moment of 20,100 lb • in. You are required to create two-dimensional (2D) and three-dimensional (3D) stress elements for two stress states on the outer and inner surfaces of the bar to in-plane and out-of-plane stresses, respectively and then draw the 2D and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT