Thursday, April 21, 2016

Advanced Topics in SQL - SQL tutor / class in NYC New York Manhattan

SQL tutor / class in NYC New York Manhattan
Basic Topics:
Executing a Simple Query
Working with Functions
Organizing Data
Retrieving Data from Multiple Tables using Joins
Presenting Query Results
Querying Using Subqueries
Manipulating Table Data
Stored Procedures

Converting numbers to dates using timestamps. - this is topic of Orcale SQL, but I guess I will get something related to SQL Server.

Exceptions, error handling in the code

Handling duplicates

Date functions

Intercept, except, union, union all - the differences between them

Inline Table-Valued Functions

Recursive Queries,
This is done using CTE - where we will keep doing some recursion until we are done

APPLY Operator,

Offset Window


Data Modification; Working with Date and Time;

Questions on Date:
Many interesting questions are listed on:

Programmable Objects, Transactions and Concurrency, Exception Handling); In-Memory OLTP.

Along the course you will learn how to use T-SQL to solve practical problems such as:

Relational Division, Missing and Existing Ranges (Gaps and Islands),

Separating Elements, Pivoting and Unpivoting, Ranking and Offset, Running Totals, Moving

Averages, YTD, Custom Aggregations, Dynamic Analysis of Grouping Sets, TOP and



Data De-Duplication,

Handling Sequences,

Merging Data,

Treatment of Temporal Intervals (Intersection, Max Concurrent, Packing),

Dynamic Filtering,

Migrating On-Disk to Memory Optimized Data,

Internals and index tuning,

including coverage of Column store data, index access methods, temporary


set vs. cursors,

Cursors enable manipulation of whole result sets at once. In this scenario, a cursor enables the rows in a result set to be processed sequentially. In SQL procedures, a cursor makes it possible to define a result set (a set of data rows) and perform complex logic on a row by row basis.

query tuning using query.



New York
New York city
SQL Tutor Trainer

Advanced SQL Topics

Functions, Stored Procedures, Packages
Pivoting data: CASE & PIVOT syntax
Hierarchical Queries
Cursors: Implicit and Explicit
Dynamic SQL
Materialized Views
Query Optimization: Indexes
Query Optimization: Explain Plans
Query Optimization: Profiling
Data Modelling: Normal Forms, 1 through 3
Data Modelling: Primary & Foreign Keys
Data Modelling: Table Constraints
Data Modelling: Link/Corrollary Tables
Full Text Searching
Isolation Levels
Entity Relationship Diagrams (ERDs), Logical and Physical
Transactions: COMMIT, ROLLBACK, Error Handling

Sunday, April 3, 2016

Dynamic SQL

Dynamic SQL

Example from AdventureWorks:

Dynamic SQL and Procedures:

SQl Server Dynamic SQL:

Dynamic SQL / Adhoc SQL (6 min short video):

Table names would vary at run time and schema would vary at runtime:

Advanced SQL

Advanced SQL consist of new queries in SQL

There is over 100 videos and interview questions on:

i want to master of joins, paritition, views, trigger, dynamicswql

what database do you practice?
functions, proc, in oracle pl sql
i have both oracle sql and ms server 2008

try 2 question for today
find the 2nd highest salary of employees table

2. list employees alongwith their manager in employees table

this was asked in interview with me in the currentjo

3. find information of those employees whose salary is greater than average salary of their respective departments
after that query that I sent you
it returns 1st row of each join no matter how many matches are there
if in two tables you only want to join first row and no other row
you need to use row_number, partition by and subquery
this question is trending now in interviews

select * from employees x, (select DEPARTMENT_ID,avg(salary) avg_salary from employees group by department_id) y where x.department_id=y.department_id and x.salary>y.avg_salary;
this is query to compare salary of each employee against avg salary of department and display only those with highest salary

can you write query to select max salary for each department?
using cte
WITH cteRowNum AS ( SELECT DeptID, EmpName, Salary, DENSE_RANK() OVER(PARTITION BY DeptID ORDER BY Salary DESC) AS RowNum FROM EmpDetails ) SELECT DeptID, EmpName, Salary FROM cteRowNum WHERE RowNum = 1;

These analytical functions are known as window function in sql server

dynamic sql