Date - 4th Jan 2023
All the SQL Syntax and projects
SELECT (List of column Names) FROM [Schema Nema].[Table Name] WHERE (Condition is True/False)
-
Comments starts with '--'
-
While writing where conditions it has to be excat matches.
-
% sign indicates wild card in Where condition.
-
- sign means it includes all the tables from dataset
-
To return null participants use IS NULL or IS NOT NULL conditions.
-
Logical Operators in Where Clause a) And - Both Conditions must be true b) or - Atleast one condition must be true c) Conditions are evaluated in the order they occur in code d) conditions in parenthesis are treated as a single unit and are evaluated together.
-
A bit column can store either a 1, representing true, or a 0, representing false. If a column is declared as NOT NULL, data is required in that column.
-
Adding Distinct after select gets rid off duplicate orders in tab;e.
- Joints allows us to use common relationships, such as foreign key relationships to look at data in more than one table in single query.
- INNER JOINS - Related with PK Membership is required in both tables for results to be returned in an INNER JOIN.
- OUTER JOINS - Related with Foreign Key The Order of Anchoring table matters in Outer Joins and Query results change according to it.
- Inner joins require membership in both tables, while outer joins only require membership in the anchoring table.
- Both subqueries and inner joins can be used to filter, but an inner join must be used if columns from both tables need to be returned in the query results.
- Ctrl + R - To show/hide Query result panel
- F5 - Execute