Saturday, May 28, 2016

Complexity and Recursion

Complexity and Recursion

Complexity of Algorithms - how to find out how it is log

Table to calculate - which complexity

If there is a power: n^2

Logic of what? Chapters of logic.

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

Saturday, March 19, 2016

R code for Breaking X/Y axis


# Example 1
x <- c(9.45, 8.78, 0.93, 0.47, 0.24, 0.12)
y <- c(10.72, 10.56, 10.35, 10.10, 9.13, 6.72)
z <- c(7.578, 7.456, 6.956, 6.712, 4.832, 3.345)
plot(x, y, col='blue', pch=16, xlab= 'x', ylab='y, z')
points(x, z, col='red', pch=17)

#Break X axis

xgap <- ifelse(x > 8, x-6, x)
#Possibly you'd want to check if there are values between 2 and 8.
plot(xgap, y, col='blue', pch=16, xlab= 'x', ylab='y, z', xaxt="n")
points(xgap, z, col='red', pch=17)
xat <- pretty(xgap)
xat <- xat[xat!=2]
xlab <- ifelse(xat>2, xat+6, xat)
axis(1,at=xat, labels=xlab)

par(bty="n") # deleting the box
gap.plot(x,y, gap=c(2,7.5), gap.axis="x", pch=16,
         col="blue", ylim=range(c(y,z)),
         xtics=c(0:3,8:10), xticlab=c(0:3,8:10))

gap.plot(x,z, gap=c(2,7.5), gap.axis="x", pch=17,
         col="red", ylim=range(c(y,z)), add=TRUE); axis(2)

abline(v=seq(1.99,2.09,.001), col="white")  # hiding vertical lines

# Break Y Axis

ygap <- ifelse(y > 8, y-6, y)
#Possibly you'd want to check if there are values between 2 and 8.
plot(ygap, x, col='blue', pch=16, xlab= 'x', ylab='y, z', yaxt="n")
points(ygap, z, col='red', pch=17)
yat <- pretty(ygap)
yat <- yat[yat!=2]
ylab <- ifelse(yat>2, yat+6, yat)
axis(2,at=yat, labels=ylab)

Tuesday, March 15, 2016

OLAP Cubes in SQL Server for Adventure Works

OLAP Cubes in SQL Server for Adventure Works


To install Other Databases check out

Saturday, March 12, 2016

Importing HTML file in Excel using VBA

This proc opens HTML files in excel, copy it into the sheet and then close the html without saving.
This ways you can import data from various html files into excel.
This can be modified to import values from other format like XML also.
This is a although very mundane way but VBA 6 is very old, VBA.NET might have something better.

For learning more VBA skills please check out our courses at

Sub Import()
Dim oExcel As Excel.Application
Dim ws, ws2, ws3 As Worksheet
Dim wb As Variant
Dim wkb As Variant

Set activewkb = ThisWorkbook
Path = ActiveWorkbook.Path

   Dim StrFile As String
    Path = ActiveWorkbook.Path
   ' MsgBox Path
    StrFile = Dir(Path & "\HTML\")
    Do While Len(StrFile) > 0
        MsgBox StrFile
        StrFile = Dir
   ' MsgBox StrFile
    Set wb = Workbooks.Open(Path & "\HTML\" & StrFile)
On Error Resume Next
'MsgBox ActiveWorkbook.Path

For Each sh In wb.Sheets
      sh.Copy after:=activewkb.Sheets(activewkb.Sheets.Count)
   Next sh

'MsgBox "The name of the active workbook is " & ActiveWorkbook.Name
wb.Close savechanges:=False

End Sub

Monday, March 7, 2016

Debug Command to print Files

Sub LoopThroughFiles2()
    Dim StrFile As String
    Path = ActiveWorkbook.Path
    StrFile = Dir(Path & "\")
    Do While Len(StrFile) > 0
        Debug.Print StrFile
        StrFile = Dir
End Sub

Sunday, February 7, 2016

Demand of Java and Javascript will create the most Jobs in 2015

Since we are in IT Boom the highest demand would still be in the same areas as it has been in last five years.

I am attaching below the images and charts of the most popular coding language which will pay you the best salary in 2015.

Python is used extensively in Big Data Analytics with the Panda library.

JavaScript and full stack developer, Angular JS,  are some terms that I see most often.

Big data boom is still be realized but most of the work still remains in labs.