SQL Joins Tutorials For Beginners | Inner Left Right Full Outer Joins
SQL Joins Tutorials For Beginners | Inner Left Right Full Outer Joins Let's understand the types of joints in SQL in simple language what is expected from this tutorial what are joints and types of joints let's see what are joins joins in SQL joints help retrieving data from two or more database tables INSERT UPDATE DELETE DML Statement : https://youtu.be/30VX5GLun3M Everything about SELECT Statement : https://youtu.be/ilVVa8uVNeM DDL Statements : https://youtu.be/DocoAjPqHss Constraints in SQL : https://youtu.be/nv6Ow0emAJ0 Datatypes in SQL : https://youtu.be/PedrfjN-PCo Command Types in SQL : https://youtu.be/VZtRsZ4klhc Oracle Live Free :- https://youtu.be/g257vfnM2mo MySQL Download & Installation :- https://youtu.be/ErtPrysapLc the tables are mutually related using primary and foreign keys in other words at least there should be there should have one column values matching with one column from the another table there are five different types of joints in the SQL those are inner join it's also called as simple join left join it is also called as left outer join outer is the word which is optional right outer join number four full outer join five cross join cross join is also called as Cartesian product let's see the first type of join that is inner join the inner join is used to return rows from both the tables that satisfy the given condition in other words only those records will be returned which are matching in both the tables which has a matching in both the tables the syntax is select star from table 1 inner join table 2 on join condition where table dot field equals to table dot table two dot field we can mention there is another syntax where we can mention the name of the columns which we want to retrieve so instead of star we can use the names of the columns from both the tables in that way you can only specify the columns records you want in your result set column names from table 1 inner join table 2 on table 1 dot field equals to table2 dot field let's say this with example we are going to use EMP and DPT tables for our inner join explanation in our EMP table we have four records and in DPT we have four records both tables are going to join on DPT number before executing any query I'm going to demonstrate this in a Excel so what will happen if we join these two tables on department number columns I just kept it side by side so that I can explain it properly so if we join it we will have first record join with the first record because they have 10 Deep department number 20 and 30. so first three records will join with the first three records in the department table and this will be the output for us what will happen with the remaining records this 50 department number from employee table doesn't have any match with the Department table department number column so this is not going to come into our result set whereas Department 40 from the Department table doesn't have any matching records with the employee employ table and that's why this is also not going into the a result set we will see how to bring them in the next left and right joint but for now using the inner join we will see only these three records coming into the result set now let's execute the query before executing this join query let me show you the records in the amp and DPT tables those are already shown you in the Excel worksheet but it's the same you can see 20 10 20 30 and 50 in EMP whereas we have three um four records in DPT table with 10 20 30 and 40. now let's execute our inner join query select star from EMP inner join DPT on emp.dpdno equals to dpt.e dptno and order by D name I just order it by the department so let's run this and as I told select instead of Select star you can mention the column names you want in your output but for now let's use select star let's execute this you see we got three records output and it's matching with our Excel output which I just showed you it is because only three records are having match from amp table to the DPT table so this is inner join join next is left outer join the left join returns all the rows from the left table even if no matching rows found in the right table so no matches found in the right table will return nulls from the right table in that particular row the syntax is Select columns from table 1 left join table 2 or table one dot field equals to table 2 dot field that is the join condition before executing the left join query let's understand the table and the records on the Excel so we have EMP and DPT tables which we are using for this example so in EMP table we have four records and dpd we have four records and we are joining on DPT number so while we will be joining on joining these two tables on a left join all the records from the left table will come into our result set final result set now SQL Joins Tutorials For Beginners | Inner Left Right Full Outer Joins
Download
0 formatsNo download links available.