Friday, January 19, 2018

SQL : Dynamic SQL


Dynamic SQL in SQL Server


Declare @sql nvarchar(1000)

set @sql= 'Select * from Employees'

Execute sp_executesql @sql

~

Declare @sql nvarchar(1000)
Declare @params nvarchar(1000)

set @sql= 'Select * from Employees'  + '  Where FirstName=@FirstName and  LastName=@LastName'

set @params = '@FirstName nvarchar(100), @LastName nvarchar(100)'

--Print @sql

Execute sp_executesql @sql, @params , @FirstName='Test', @LastName ='Test'





Select * from INFORMATION_SCHEMA.TABLES

~

DECLARE @SqlString  NVARCHAR(1000)
DECLARE @Count INT
DECLARE @TblName SYSNAME = (SELECT MIN(Table_Name) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE')
WHILE (@TblName IS NOT NULL)
BEGIN
SELECT @TblSchema=Table_Schema FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME= @TblName
SET @SqlString= 'SELECT @RecCount=COUNT(1) FROM' + @TblSchema + '.' +@TblName
EXEC sp_ExecuteSql @SqlString,N'@RecCount INT OUTPUT'
                                                       ,@RecCount= @Count OUTPUT;
PRINT 'The Table:""+@TblSchema+'.'+@TblName"" HAS'+CAST(@Count AS VARCHAR(1000))+'Records';
END

Learning Subjects: BI Stack-Scripting Language-Web Page Design-Database-XML/NOSQL-Apps-Big Data


MICROSOFT

BI Stack

           BUSINESS INTELLIGENCE

                                                                  ETL: SSIS
                                                   
                                                                         61 videos

   

                                                                 Analytics:SSAS

                                                                                         23 videos


                                                                 Reporting:SSRS

                                                                          26 videos


           Scripting Language

                                                                 C#

                                                                           c# tutorial for beginners

                                                                                 100 videos.

          Web Page Design

                                                            ASP.NET

                                                                        ASP.NET tutorial for beginners

                                                                               171 videos.



         Database

                                                     SQL Server tutorial for beginners

                                                                                135 videos


                                                     SQL Server Interview Questions and Answers


                                                                               13 videos


                         DBA lessons. 

                                                    

                                     SQL Server Database Administrations


                                                   1.CDC   (Simple Talk article)

                                                   2.DQS  

                                                   3.MDM  


*********************************************************************************

                                                           XML/NOSQL

*********************************************************************************

        Learn XML in 30 days


                                             XML Tutorials

*********************************************************************************



*********************************************************************************

                                                          TreeHouse:


                                                         iPhone apps

                                                         HTML

                                                         CSS

                                                         build websites

                                                         build websites & apps


*********************************************************************************


*********************************************************************************


                                         Big Data ( Hadoop ) ( Tableau )

                                         Cloud Computing

                                         Saas

                                         Open Source Database (MySQL)



*********************************************************************************

                                                          erwin

*********************************************************************************

                                                    share point portal


*********************************************************************************


ADO Introduction


ADO Introduction

ADO can be used to access databases from your web pages.

ADO.NET is a data access technology from the Microsoft .NET Framework that provides communication between relational and non-relational systems through a common set of components.



Tableau reporting



*********************************************************************************

               Learn Tableau step by step for Beginners


*********************************************************************************






*********************************************************************************


                               Tableau - Introduction


*********************************************************************************


  Tableau is a Business intelligence tool 
<- Help to analyze data in a visual manner like graph, reports etc.

Example: Excel, BigData,Hadoop, Any Cloud database ( listed)

Tools provided by Tableau:

         {Tableau Desktop
         Tableau Online} <- Create Reports
         {Tableau Server
         Tableau Reader
         Tableau Public}<- Publishing Reports

Tableau has a good connectivity to different databases.

Spreadsheet

Database

BigData

Access Data warehouse

Cloud Applications

Cloud Databases

50 + Different databases

When you create reports you want to publish on different devices.

It supports:

Places to publish the report.

Desktop

Tablet

Phone

How Tableau Considers Database:


Example:

Excel - To analyze the data it first converts into a Pivot table.

The excel file data it understands by "Dimensions" , "Measures".

Dimensions  - date,text,geographical data

Measures - numbers,floats,calculated fields

The front end of the Tableau:

Data                             Pages                                         Columns

Global store 2007        Filters                                        Rows 

Dimensions                 Marks                                         Sheet 1

Measures                     

Data Source                Color   Size    Text
                                    Detail  Tooltip

Tableau - supports 24 different types of charts.

(Bar Chart,Stacked Bar Chart,Pie Chart,Line Chart,Scatterd charts,
Packed Bubble Chart,Word Map,Tree Maps,Waterfall Chart,Basic Funnel Chart,Advanced Funnel Chart

So Why use Tableau?

Speed
User-friendly
Beautiful and interactive Dashboard
Direct Connection
Easy publishing and sharing
Growing Market

Gartner - compares the different BI tools across the world.
             - Tableau is the best product all across the world.

Summary:

What exactly is Tableau?
Different Types of Tableau product available in the market.
What are the different types of charts we can prepare
What the different types of database we can connect with the Tableau?



********************************************************************************
  

             Tableau - Download Desktop

                             

                           Tableau - Install Desktop


*********************************************************************************

tableau.com

tableau 10.2

Tableau Book1

Connect

To a File

Excel
Text File
Access
JSON File
Spatial File
Statistical file

To a Server

Tableau Server
Microsoft SQL Server
MySQL
Oracle
Amazon Redshift




*********************************************************************************

                                Tableau - Connecting With Different Database





*********************************************************************************

                                           


*********************************************************************************

                                          Tableau Vs Excel


*********************************************************************************

Connect

choose - "Sheet1"

*********************************************************************************

Tableau - Live Vs Extract



*********************************************************************************



DataSource

*********************************************************************************




*********************************************************************************
7.

Tableau - Data Type


*********************************************************************************

6 data types:
Number(decimal),Number(Whole),Date & Time,Date,String,Boolean,Default,Geographic Role


*********************************************************************************
8.

Tableau - View Data




*********************************************************************************
9.

Tableau - Column Formatting



*********************************************************************************
10.

Tableau - Sort



*********************************************************************************


*********************************************************************************
11.

Tableau - Drill Down And Hirearchies


*********************************************************************************
12.

Tableau - Sorting



*********************************************************************************

*********************************************************************************
13.

Tableau - Grouping


*********************************************************************************
14.


Tableau - Measure Name And Values

When you connect with different data sources or Importing - there are 5 auto generated fields (Italic)

Dimensions:

Measure Names


Measures:

Latitude ( generated)
Longitude(generated)
Number Of Records
Measure Values

~How to get Grand Total
Analysis Menu Bar->

~Drag from Dimensions->Measure Names

Then drag "Measure Values" ->

All "Measures" will show

Measure Values: Except Longitude and Latitudes
SUM(Discount)
..
SUM(..)

~Double click -> "Measure Values" <- Shows a graphical representation


*********************************************************************************
Tableau

File Data Worksheet Dashboard Story Analysis Map Format Server Window Help

Data               Analytics      Pages                                    Columns:

Global Super Store 2017    Filters                                   Rows:Market

Dimensions                         Marks                                   Number Of Records

  -Category                           Automatic                            Market
  -City
  -Country                             Color .  Size     Text             India        100000
  -Customer ID                                                                   US           50000
  -Customer Name                Default . ToolTip                   JAPAN   30000
  -Market
  -Order Date                        SUM(Number...)
  -Order ID
  -Order Priority

Measures

    -Discount
    -Profit
    -Quantity
    -Sales
    -Shipping Cost
    -Latitude (generated)
    -Longitude (generated)
    -Number Of Records
    -Measure Values

*********************************************************************************
  
15.

Tableau - Measure Names Usage


Used Combining Charts fails.

Menu->Worksheet->New Worksheet

Drag ->Order Date <-Columns
Drag->Profit,Discount,Shipping cost <Rows

If you want to combine all 3 and see in one graph.

From ->Rows - click on ("Discount)-> Down arrow key - show "Dual" Axis
Only in the "Discount" menu it would show the "Dual" option but it won't show on "First" or "Third"

To show all three graphs in one.

Drag "Order Date" to the columns.

"Filters" <- Drag "Measure Names" (Choose)
Discount
Numer Of Records
Profit
Quantity
Sales

Drag -> "Measure Values" to "Rows"

Drag-> "Measure Names" to "Color" 

To give "Lines"  to the graph , drag the "Measure Names" to the "Label".


*********************************************************************************

16.


Tableau - Discrete Vs Continous

Discrete -distinguished ( dimension - see the values )
Continous - ( sum() - not shown separately as values )


*********************************************************************************



*********************************************************************************

*********************************************************************************  
19.


Tableau - Sets

*********************************************************************************
20

Tableau - Title And Caption


21.

Tableau - Exporting
22.

Tableau - Worksheet Interface


23.

Tableau - Managing Metadata


24.


Tableau - Cross Database Joins


25.

Tableau - Data Blending

Menu ->Edit->Relationships

26.


Tableau - Data Blending Calculations

ZN ( ) <- Null value to replace with 0 

27.

Tableau - Filters Shelf

28.

Tableau - Date Filters

29.


33.

Tableau - Ways To Filter

34.


35.



*********************************************************************************

                                      .NET Interview Preparation videos

                                                 QuestPond

*********************************************************************************










*********************************************************************************