Posts

Showing posts from August, 2018

Data Types and Modifiers in C++ - The Coding Shala

Image
Home >> Learn C++ >> Data Types and Modifiers in C++ Data types and Modifiers in c++ In every program we need to store values for that variable are used. Variables are just reserved memory location to store values. every variable reserve some space in memory. Data Types are used to define the type of data a variable can hold, for example, a character type variable can hold character data, integer variable can hold integer data. data types are necessary to define with variables. Data types in C++ are divided into three groups - Primitive Data types or Built-in Data Types Abstract or user-defined data types Derived Datatypes In this post we are going to discuss primitive data types only, user-defined and derived data types will cover in later posts. Primitive or Built-in Datatypes These data types are predefined data types in c++ and we can use these data types directly to declare variables. The following image shows data types and their Ke...

SQL CARTESIAN JOIN or CROSS JOIN - The Coding Shala

Image
Home >> Learn SQL >> SQL CARTESIAN JOIN SQL CARTESIAN JOIN or CROSS JOIN The SQL CARTESIAN JOIN returns the cartesian product of the sets of rows from the joined tables. SQL CARTESIAN JOIN is also called SQL CROSS JOIN. SQL CARTESIAN JOIN Syntax The basic syntax of SQL CARTESIAN JOIN or CROSS JOIN is as follows -  SELECT table1.column1, table2.column2... FROM table1, table2 [, table3 ]; SQL CARTESIAN JOIN Examples The following two tables are used for the examples - Table 1. ' emp ' table  emp_id emp_name city dept_no salary 1 Akshay Pune 101 50000 3 Nikhil Pune 101 51000 5 Mohit Delhi 103 40000 6 Shubham Surat 105 42000 7 Akash Mumbai 106 45000 Table 2. ' dept ' table   dept_no dept_name total_e...

SQL SELF JOIN - The Coding Shala

Image
Home >> Learn SQL >> SQL SELF JOIN SQL SELF JOIN The SQL SELF JOIN is used to join a table to itself. To perform SELF JOIN we use aliases to temporarily change the table's name. SQL SELF JOIN Syntax The basic syntax of SQL SELF JOIN is as follows -  SELECT a. column_name , b. column_name ... FROM table1 a, table1 b WHERE a.common_field = b.common_field; SQL SELF JOIN Example The following ' emp ' table is used for the examples -  emp_id emp_name city dept_no salary 1 Akshay Pune 101 50000 3 Nikhil Pune 101 51000 5 Mohit Delhi 103 40000 6 Shubham Surat 105 42000 7 Akash Mumbai 106 45000 The following SQL statement will join this table using SELF JOIN -  SQL >> select a.emp_id, a.emp_name, b.sal...

SQL FULL JOIN - The Coding Shala

Image
Home >> Learn SQL >> SQL FULL JOIN SQL FULL JOIN The SQL FULL JOIN or SQL FULL OUTER JOIN returns all the records when there is a match on either left or the right table. The SQL FULL OUTER JOIN is a combination of a LEFT OUTER JOIN and RIGHT OUTER JOIN.  SQL FULL OUTER JOIN Syntax The basic syntax of the FULL JOIN is as follows -  SELECT table1.column1, table2.column2, .. FROM table1 FULL OUTER JOIN table2 ON table1. column_name = table2. column_name ; SQL FULL OUTER JOIN Example The following two tables are used for the example - Table 1.  'emp'  table  emp_id emp_name city dept_no salary 1 Akshay Pune 101 50000 3 Nikhil Pune 101 51000 5 Mohit Delhi 103 40000 6 Shubham Surat 105 42000 7 Akash Mumbai 106 45000 Table 2. ' dept ' table...

SQL RIGHT JOIN - The Coding Shala

Image
Home >> Learn SQL >> SQL RIGHT JOIN SQL RIGHT JOIN The SQL RIGHT JOIN is a part of the OUTER JOIN. The SQL RIGHT JOIN or SQL RIGHT OUTER JOIN returns all the records from the right table and matching records from the left table. If there is no match in the left table then it returns NULL values from the left table. SQL RIGHT JOIN Syntax The basic syntax of the RIGHT JOIN is as follows -  SELECT table1.column1, table2.column2, .. FROM table1 RIGHT JOIN table2 ON table1. column_name = table2. column_name ; SQL RIGHT JOIN Example The following two tables are used for the examples -  Table 1. ' emp ' table  emp_id emp_name city dept_no salary 1 Akshay Pune 101 50000 3 Nikhil Pune 101 51000 5 Mohit Delhi 103 40000 6 Shubham Surat 105 42000 7 ...

SQL LEFT JOIN - The Coding Shala

Image
Home >> Learn SQL >> SQL LEFT JOIN SQL LEFT JOIN The SQL LEFT JOIN is a type of OUTER JOIN. The SQL LEFT JOIN or SQL LEFT OUTER JOIN returns all the records from the left table and matched records from the right table. If there is no match in the right table then it returns NULL values from the right table. SQL LEFT JOIN SYNTAX The basic syntax of the LEFT JOIN is as follows -   SELECT table1.column1, table2.column2, .. FROM table1 LEFT JOIN table2 ON table1. column_name = table2. column_name ; SQL LEFT JOIN Example The following two tables are used for the example -  Table 1. ' emp ' table  emp_id emp_name city dept_no salary 1 Akshay Pune 101 50000 3 Nikhil Pune 101 51000 5 Mohit Delhi 103 40000 6 Shubham Surat 105 42000 7 ...

SQL INNER JOIN - The Coding Shala

Image
Home >> Learn SQL >> SQL INNER JOIN SQL INNER JOIN SQL INNER JOIN is the most important and frequently used to join. INNER JOIN is also referred to as  EQUIJOIN . The SQL INNER JOIN selects records that have matching values in both tables. INNER JOIN SYNTAX The basic syntax of SQL INNER JOIN is following -  SELECT table1.column1, table2.column2, .. FROM table1 INNER JOIN table2 ON table1. column_name = table2. column_name ; SQL INNER JOIN EXAMPLE The following two tables are used for the examples. Table 1. ' emp ' table -  emp_id emp_name city dept_no salary 1 Akshay Pune 101 50000 3 Nikhil Pune 101 51000 5 Mohit Delhi 103 40000 6 Shubham Surat 105 42000 7 Akash Mumbai 106 45000 Table 2. ' dept ' tabl...