Please, No handwriting COURSE; introduction to database Define and explain the following with example: 1. Outer Joins 2. Views 3....

90.2K

Verified Solution

Question

Programming

Please, No handwriting

COURSE; introduction to database
Define and explain the following with example:
1. Outer Joins
2. Views
3. Transactions
4. Audit Trails

Answer & Explanation Solved by verified expert
4.2 Ratings (878 Votes)
1SQL OUTERJOINIn the SQL outer JOIN all the content of the both tables areintegrated together either they are matched or notIf you take an example of employee tableOuter join of two types1Left outer join also known as left jointhis join returns all the rows from left table combine with thematching rows of the right table If you get no matching in theright table it returns NULL values2Right outer join also known as right jointhis join returns all the rows from right table are combined withthe matching rows of left table If you get no column matching inthe left table it returns null valueThis diagram shows the different type of joinsSQL LEFT JOINThe SQL left join returns all the values from the left table andit also includes matching values from right table if there are nomatching join value it returns NULLBASIC SYNTAX FOR LEFT JOINSELECT table1column1 table2column2FROM table1LEFTJOIN table2ON table1columnfield table2columnfieldlet us take two tables in this example to elaborate all thethingsCUSTOMER TABLEIDNAMEAGESALARY1ARYAN51560002AROHI21250003VINEET24310004AJEET23320005RAVI2342000This is second tableORDER TABLEOIDDATECUSTOMERIDAMOUNT0012001201223000002120220122200000322032012340000041104201245000join these two tables with LEFT JOINSQL SELECT ID NAME AMOUNTDATEFROM CUSTOMERLEFT JOIN ORDERON CUSTOMERID ORDERCUSTOMERIDThis will produce the following resultIDNAMEAMOUNTDATE1ARYANNULLNULL2AROHI3000200120122AROHI2000120220123VINEET4000220320124AJEET5000110420125RAVINULLNULLSQL RIGHT JOINThe SQL right join returns all the values from the rows of righttable It also includes the matched values from left table but ifthere is no matching in both tables it returns NULLBasic syntax for right joinSELECT table1column1 table2column2FROM table1RIGHT JOIN table2ON table1columnfield table2columnfieldlet us take an example with 2 tables table1 is CUSTOMERS tableand table2 is ORDERS tableCUSTOMER TABLEIDNAMEAGESALARY1ARYAN51560002AROHI21250003VINEET24310004AJEET23320005RAVI2342000and this is the second tableORDER TABLEDATEOIDCUSTOMERIDAMOUNT2001201200123000120220120022200022032012003340001104201200445000Here we will join these two tables with SQL RIGHT JOINSQL SELECT IDNAMEAMOUNTDATEFROM CUSTOMERRIGHT JOIN ORDERON CUSTOMERID ORDERCUSTOMERIDIDNAMEAMOUNTDATE2AROHI3000200120122AROHI2000120220123VINEET4000220320124AJEET500011042012SQL FULL JOINThe SQL full join is the result of combination of both left andright outer join and the join tables have all the records from bothtables It puts NULL on the place of matches not foundSQL full outer join and SQL join are same generally it is knownas SQL FULL JOINSQL full outer joinWhat is SQL full outer joinSQL full outer join is used    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students