• SQL – Self Join

    SQL – Self Join

    SQL Self Join Table Of Contents: What Is SQL Self Join? Syntax Of SQL Self Join. Examples Of SQL Self Join. (1) What Is SQL Self Join? When you are joining the same table to itself it’s called Self Join. (2) Syntax Of SQL Self Join Syntax: SELECT column_name(s) FROM table1 T1, table1 T2 WHERE condition; (3) Examples Of SQL Self Join Customer: Example-1: SELECT A.CustomerName AS CustomerName1, B.CustomerName AS CustomerName2, A.City FROM Customers A, Customers B WHERE A.CustomerID <> B.CustomerID AND A.City = B.City ORDER BY A.City;

    Read More

  • SQL – Full Outer Join

    SQL – Full Outer Join

    SQL Full Outer Join Table Of Contents: What Is SQL Outer Join? Syntax Of SQL Outer Join. Examples Of SQL Outer Join. (1) What Is SQL Outer Join? The FULL OUTER JOIN keyword returns all records when there is a match in left (table1) or right (table2) table records. FULL OUTER JOIN and FULL JOIN are the same. (2) Syntax Of SQL Outer Join? Syntax: SELECT column_name(s) FROM table1 FULL OUTER JOIN table2 ON table1.column_name = table2.column_name WHERE condition; (3) Examples Of SQL Outer Join? Customer: Orders: Example-1: SELECT Customers.CustomerName, Orders.OrderID FROM Customers FULL OUTER JOIN Orders ON Customers.CustomerID=Orders.CustomerID ORDER BY Customers.CustomerName; Note:  The FULL OUTER

    Read More

  • SQL – Right Join

    SQL – Right Join

    SQL – Right Join Table Of Contents: What Is SQL Right Join? Syntax Of SQL Right Join. Examples Of SQL Right Join. (1) What Is SQL Right Join? The RIGHT JOIN keyword returns all records from the right table (table2), and the matching records from the left table (table1). The result is 0 records from the left side if there is no match. (2) Syntax Of SQL Right Join Syntax: SELECT column_name(s) FROM table1 RIGHT JOIN table2 ON table1.column_name = table2.column_name; (3) Examples Of SQL Right Join Order: Employees: Example-1: SELECT Orders.OrderID, Employees.LastName, Employees.FirstName FROM Orders RIGHT JOIN Employees ON Orders.EmployeeID =

    Read More

  • SQL – Left Join

    SQL – Left Join

    SQL – Left Join Table Of Content: What Is SQL Left Join? Syntax Of SQL Left Join. Examples Of SQL Left Join. (1) What Is SQL Left Join? The LEFT JOIN keyword returns all records from the left table (table1), and the matching records from the right table (table2). The result is 0 records from the right side if there is no match. (2) Syntax Of SQL Left Join. Syntax: SELECT column_name(s) FROM table1 LEFT JOIN table2 ON table1.column_name = table2.column_name; (3) Examples Of SQL Left Join. Customer Table: Orders Table: Example-1: SELECT Customers.CustomerName, Orders.OrderID FROM Customers LEFT JOIN Orders ON

    Read More

  • SQL – Inner Join

    SQL – Inner Join

    SQL – Inner Joins Table Of Contents: What Is SQL Inner Join? Syntax Of SQL Inner Join. Examples Of SQL Inner Join. (1) What Is SQL Inner Joins? The INNER JOIN keyword selects records that have matching values in both tables. (2) Syntax Of SQL Inner Joins? SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name; (3) Examples Of SQL Inner Joins? Order Table: Customer Table: Example-1: Joining Two Tables SELECT Orders.OrderID, Customers.CustomerName FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID; Example-2: Joining Three Tables SELECT Orders.OrderID, Customers.CustomerName, Shippers.ShipperName FROM ((Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID) INNER

    Read More

  • SQL – Joins

    SQL – Joins

    SQL – Joins Table Of Contents: What Are SQL Joins? Types Of SQL Joins. (1) What Are SQL Joins? SQL Joins allow us to work on multiple tables by joining them together based on a related column. By bringing tables together you can have more information about the item. (2) Types Of SQL Joins? (INNER) JOIN: Returns records that have matching values in both tables LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left

    Read More

  • SQL – Aliases

    SQL – Aliases

    SQL – Aliases Table Of Contents: What Is SQL Aliases? Syntax Of SQL Aliases. Examples Of SQL Aliases. (1) What Is SQL Aliases? SQL aliases are used to give a table, or a column in a table, a temporary name. Aliases are often used to make column names more readable. An alias only exists for the duration of that query. An alias is created with the AS keyword. (2) Syntax Of SQL Aliases. Syntax: Alias Column Syntax SELECT column_name AS alias_name FROM table_name; Syntax: Alias Table Syntax SELECT column_name(s) FROM table_name AS alias_name; (3) Examples Of SQL Aliases. Demo Dataset: Example-1: SELECT

    Read More

  • SQL – Between Operator

    SQL – Between Operator

    SQL – Between Operator Table Of Contents: What Is SQL Between Operator? Syntax Of SQL Between Operator. Examples Of SQL Between Operator. (1) What Is SQL Between Operator? The BETWEEN operator selects values within a given range. The values can be numbers, text, or dates. The BETWEEN operator is inclusive: begin and end values are included.  (2) Syntax Of SQL Between Operator? Syntax: SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2; (3) Examples Of SQL Between Operator? Demo Data: Example-1: Between Example SELECT * FROM Products WHERE Price BETWEEN 10 AND 20; Example-2: Not Between Example SELECT * FROM Products WHERE Price

    Read More

  • SQL – In Operator

    SQL – In Operator

    SQL – In Operator Table Of Contents: What Is An “In” Operator? Syntax Of “In” Operator. Examples Of “In” Operator. (1) What Is An “In” Operator ? The IN operator allows you to specify multiple values in a WHERE clause. The IN operator is a shorthand for multiple OR conditions. (2) Syntax Of “In” Operator ? Syntax: SELECT column_name(s) FROM table_name WHERE column_name IN (value1, value2, …); (3) Examples Of “In” Operator ? Demo Data: Example-1: Country in “Germany”, “France” or “UK” SELECT * FROM Customers WHERE Country IN (‘Germany’, ‘France’, ‘UK’); Example-2: Country Not in “Germany”, “France” or “UK” SELECT * FROM Customers WHERE Country NOT IN

    Read More

  • SQL – Wild Card Characters.

    SQL – Wild Card Characters.

    SQL – Wild Card Characters. Table Of Contents: What Is A Wild Card Character? Syntax Of Wild Card Characters. Examples Of Wild CardCharacters. (1) What Is A Wild Card Character? Wild card characters are special characters used for placeholder purposes. You can place one or more characters as per their nature in place of the wild card character. (2) Syntax Of Wild Card Character. Wildcard Characters in MS Access Wildcard Characters in SQL Server Some Examples: (3) Examples Of Wild Card Character. Demo DataSet: Example-1: Using the % Wildcard: City starting with “ber”. SELECT * FROM Customers WHERE City LIKE

    Read More