SlideShare una empresa de Scribd logo
1 de 70
60 Reporting Tips in
60 Minutes
April 20 - 22, 2015 | Santa Clara, CA
Ike Ellis
Partner
Crafting Bytes
SSRS: HTML color picker websites
SSRS: Skip GIS, use MorgueFile
SSMS: Query Shortcuts
SELECT COUNT(*) FROM
SELECT TOP 100 * FROM
SSMS: Don’t forget the splitter bar
SSMS: Comment Shortcut Key
CTRL-K, C
CTRL-K, U
Lifehack: Start 2014 with a jar and fill it
with notes of good things that happen
Next New Year’s Eve, empty the jar and see what awesome
stuff happened that year.
Performance: Check for heaps/clustered
indexes
SELECT t.[Name] FROM sys.Indexes i
JOIN sys.Tables t
ON t.Object_ID = i.Object_id
WHERE i.type_desc = 'HEAP'
ORDER BY t.[Name]
Performance: Index all the keys
select object_name(c.object_id), c.name from sys.columns c
where c.name like '%id'
and c.object_id not in
(
select object_id
from sys.index_columns
)
Lifehack: Readable Presentations
Take the average age of the people in your audience and
divide by 2: That’s your font size
Do you want to know what I think you’re average is? My font size is
typically 20 – 24.
SSIS: The proper way to execute an SSIS
package
Power BI - Visualization: Bad Dashboard
Power BI - Visualization: Use color
sparingly.
In nature, colors do two things:
1) Entice
2) Warn
So let’s use them sparingly..
WARNING: POISON FROG!
Power BI -Visualization: Stephen Few
Power BI - Visualization: Cynthia Brewer
Power BI: Tips for Visualization
Make the most important information the biggest
Put it in the upper-left corner
T-SQL: No reason to use ISNULL 
CONCAT!
Messy vs clean code
No + symbol needed
No ISNULL needed
Lifehack: If you backpack, but need
news, search Wikipedia by month &
year
Search Schema: Object Explorer Details
F7
Search Schema: T-SQL
select object_name(object_id), definition as name
from sys.all_sql_modules
where definition like '%cust%'
Search Schema: SQL Search - Free
SSDT: Search options
Spotlight
T-SQL: Use windowing functions
Neat evolution
Lifehack: Presentation tip
T-SQL: Prettify!
http://extras.sqlservercentral.com/prettifier/prettifier.aspx
RedGate PlugIn for SQL Server Management Studio
TSQL: Or use SQLPrompt - RedGate
T-SQL: Execute scripts over multiple
servers
Tip: Life is so easy with a dates table
Find the sales numbers for the first Monday of every month
of the year
T-SQL with no dates table
T-SQL with dates table
Lifehack: Motorcyclist signaling cop to
other motorcyclist
Looks like a siren on top!
T-SQL: Try_Cast
Avoiding terrible casting errors
T-SQL: Never reinvent the wheel – SQL#
Take SQL# for example
Good Documentation
Easy Syntax
Cheap (and much of it is free)
LIfehack: If you take a power strip to
the airport during the winter, you’ll be a
hero
T-SQL: Save scripts in a project for easy
navigation
SSRS: Log, Log, Log (and beware of
subscriptions)select c.Name
, e.InstanceName
, e.UserName
, e.Parameters
, e.TimeStart
, e.TimeEnd
, e.TimeDataRetrieval
, e.TimeProcessing
, e.TimeRendering
from executionlog e
join catalog c
on e.reportid = c.ItemID
Send a Link, or a file on a shared folder that you can audit. Find someway to audit who opened the link or the file
in the folder. Try to avoid sending the PDF without a way to audit it.
Performance: Big lines
When troubleshooting, thick rows means lots of data, thin rows mean not much data.
You’re probably better off following the thick rows.
Lifehack: Today’s most precious
commodity – FOCUS!
SSRS: Store colors in the database
Colors = Business Logic
Put it in the database
Use Expressions to read the colors
Include action colors and levels
SSRS: Get Buy-in to Export to Single
Format
Build to export to a single format
• Excel
• Word
• Web
• PDF
Then get buy-in and make it a standard in the organization
Demo: Build to export to excel
Manage: Alias, Obscure, and De-couple
Views, Aliases
Lifehack: Keep notes daily on what you
do
Makes CVs easier
Makes reviews easier
Makes promotions easier
SSAS: Views are better than DSVs
• Easier to manage
• Can use SQL Search tools
• Can use SQL Dependency Tools
• Have a set of views only used by analysis services..so you
can change them without telling anyone else
SSRS: Used Linked Reports to Manage
Security
• Allows you to use Role assignments and
• Not have duplicate reports in folders
• Not have users in folders they shouldn’t be in
• Not manage security on individual reports
Management: Use Active Directory for
report security and cube security
User
Active Directory Group
Permission
One group – One Report
Management: Keep Report Quantity
Small
Too many reports means that there are more things to keep
consistent
Reports that aren’t used, tend to get forgotten, and then
used with bad data
Manage: Interview one person at a time
when gathering requirements
Manage: Find the key person
• They know a lot
• They have time
• They respond quickly
• They are most often right
• They might not be
likeable, and that’s OK
• Success – Work in their
office
Lifehack: If you want ambient light, do
this
SSAS: Change one thing at a time
And break calculations down to their simplest form, deploy,
test, and change one more thing.
Manage: Very few KPIs and numbers!
""The well-intentioned desire to be great at everything is
precisely what leads to exhausted
mediocrity" https://www.youtube.com/watch?v=DWKvSG_
9s5I"
Walmart customer service
SSRS: Use a report footer
Put row count there
SSRS: Report footer
Put executive sponsor there & email address
Data mart: Use friendly names
everywhere
Use spaces and long names
Manage: Use a wiki for taxonomy
Record owner
Record changes
Record technical calculation
Lifehack: Have the child call you
Whenever someone comes around saying "Would you like
to buy blah blah blah, my kid is going to do whatever."
I tell them, "Yes, I would love to! But your child has to be
the one to ask me." I then give them my number and say
the child can call anytime after 6pm.
Career: Learn in a group
SSMS: Status bar on top
SSMS: Color the status bar
Excel: Defer Layout Update
SSAS – Prevent load and delay when using
pivot tables.
Excel: Four Directional Arrow for
custom sort
Excel: Sorting is by level
Excel: Filter – Keep only selected items
And hide selected item.
Notice the total changes.
Excel: Member Search
SSMS: Script parameters
Windows: Use the middle mouse
button to close tabs
Close windows fast
Works in Chrome, SSDT, SSMS, Excel, Everywhere
SSMS: Quickly alias columns
CTRL-ALT-DOWNARROW for block selection
Manage: How to share passwords
LAST TIP! My YouTube Channel!
https://www.youtube.com/user/IkeEllisData
Contact Me!
http://blog.ikeellis.com
http://www.ikeellis.com
YouTube
• http://www.youtube.com/user/IkeEllisData
SQL Pass Book Readers
• http://bookreaders.sqlpass.org/
San Diego Tech Immersion Group
Twitter: @ike_ellis
619.922.9801
Email address is just my first name @ikeellis.com
Your feedback
is important
and valuable.
Submit by
11:59 PM PT,
April 30, 2015 to
WIN prizes
Session Evaluations
Go to
passbac2015/evals
Download the PASS
EVENT App from
your App Store and
search: PASS BAC
2015
Follow the QR code
link displayed on
session signage and
in the program
guide
for attending this
session and the
PASS Business
Analytics
Conference 2015
Thank
You

Más contenido relacionado

La actualidad más candente

OfficeWriter and the Application Platform
OfficeWriter and the Application PlatformOfficeWriter and the Application Platform
OfficeWriter and the Application Platform
SoftArtisans
 

La actualidad más candente (20)

Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriar
Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriarAdf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriar
Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriar
 
Modern ETL: Azure Data Factory, Data Lake, and SQL Database
Modern ETL: Azure Data Factory, Data Lake, and SQL DatabaseModern ETL: Azure Data Factory, Data Lake, and SQL Database
Modern ETL: Azure Data Factory, Data Lake, and SQL Database
 
R in Power BI
R in Power BIR in Power BI
R in Power BI
 
SSIS Monitoring Deep Dive
SSIS Monitoring Deep DiveSSIS Monitoring Deep Dive
SSIS Monitoring Deep Dive
 
Building Search Engines - Lucene, SolR and Elasticsearch
Building Search Engines - Lucene, SolR and ElasticsearchBuilding Search Engines - Lucene, SolR and Elasticsearch
Building Search Engines - Lucene, SolR and Elasticsearch
 
Moving to the cloud; PaaS, IaaS or Managed Instance
Moving to the cloud; PaaS, IaaS or Managed InstanceMoving to the cloud; PaaS, IaaS or Managed Instance
Moving to the cloud; PaaS, IaaS or Managed Instance
 
Agile Data Warehousing
Agile Data WarehousingAgile Data Warehousing
Agile Data Warehousing
 
Open Source DataViz with Apache Superset
Open Source DataViz with Apache SupersetOpen Source DataViz with Apache Superset
Open Source DataViz with Apache Superset
 
Tools and Tips For Data Warehouse Developers (SQLGLA)
Tools and Tips For Data Warehouse Developers (SQLGLA)Tools and Tips For Data Warehouse Developers (SQLGLA)
Tools and Tips For Data Warehouse Developers (SQLGLA)
 
ADL/U-SQL Introduction (SQLBits 2016)
ADL/U-SQL Introduction (SQLBits 2016)ADL/U-SQL Introduction (SQLBits 2016)
ADL/U-SQL Introduction (SQLBits 2016)
 
Analyzing StackExchange data with Azure Data Lake
Analyzing StackExchange data with Azure Data LakeAnalyzing StackExchange data with Azure Data Lake
Analyzing StackExchange data with Azure Data Lake
 
U-SQL Federated Distributed Queries (SQLBits 2016)
U-SQL Federated Distributed Queries (SQLBits 2016)U-SQL Federated Distributed Queries (SQLBits 2016)
U-SQL Federated Distributed Queries (SQLBits 2016)
 
SQL Azure - the good, the bad and the ugly.
SQL Azure - the good, the bad and the ugly.SQL Azure - the good, the bad and the ugly.
SQL Azure - the good, the bad and the ugly.
 
Azure data lake sql konf 2016
Azure data lake   sql konf 2016Azure data lake   sql konf 2016
Azure data lake sql konf 2016
 
Azure Data Lake and U-SQL
Azure Data Lake and U-SQLAzure Data Lake and U-SQL
Azure Data Lake and U-SQL
 
Building Enterprise Search Engines using Open Source Technologies
Building Enterprise Search Engines using Open Source TechnologiesBuilding Enterprise Search Engines using Open Source Technologies
Building Enterprise Search Engines using Open Source Technologies
 
U-SQL Query Execution and Performance Basics (SQLBits 2016)
U-SQL Query Execution and Performance Basics (SQLBits 2016)U-SQL Query Execution and Performance Basics (SQLBits 2016)
U-SQL Query Execution and Performance Basics (SQLBits 2016)
 
OfficeWriter and the Application Platform
OfficeWriter and the Application PlatformOfficeWriter and the Application Platform
OfficeWriter and the Application Platform
 
Microsoft Data Integration Pipelines: Azure Data Factory and SSIS
Microsoft Data Integration Pipelines: Azure Data Factory and SSISMicrosoft Data Integration Pipelines: Azure Data Factory and SSIS
Microsoft Data Integration Pipelines: Azure Data Factory and SSIS
 
U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for Developers
 

Destacado

Lesikar report writing basics
Lesikar   report writing basicsLesikar   report writing basics
Lesikar report writing basics
Rana Usman Sattar
 
Basics (Reports Writing 2)
Basics (Reports Writing 2)Basics (Reports Writing 2)
Basics (Reports Writing 2)
julianmillar
 
Basics (Reports Writing)
Basics (Reports Writing)Basics (Reports Writing)
Basics (Reports Writing)
julianmillar
 
Report writing
Report writingReport writing
Report writing
importerss
 

Destacado (20)

Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
11 Goals of High Functioning SQL Developers
11 Goals of High Functioning SQL Developers11 Goals of High Functioning SQL Developers
11 Goals of High Functioning SQL Developers
 
Smart Reporting: How to Stop Wasting Time and Make Better Marketing Decisions
Smart Reporting: How to Stop Wasting Time and Make Better Marketing DecisionsSmart Reporting: How to Stop Wasting Time and Make Better Marketing Decisions
Smart Reporting: How to Stop Wasting Time and Make Better Marketing Decisions
 
In time reporting: why is it a better alternative?
In time reporting: why is it a better alternative?In time reporting: why is it a better alternative?
In time reporting: why is it a better alternative?
 
Online + reporting
Online + reportingOnline + reporting
Online + reporting
 
Reporting tips & tricks
Reporting tips & tricksReporting tips & tricks
Reporting tips & tricks
 
Moneyball
Moneyball Moneyball
Moneyball
 
Report Writing
Report WritingReport Writing
Report Writing
 
Stress workshop 3 relationships 1: Couples and intimate relationships
Stress workshop 3 relationships 1: Couples and intimate relationshipsStress workshop 3 relationships 1: Couples and intimate relationships
Stress workshop 3 relationships 1: Couples and intimate relationships
 
Lesikar report writing basics
Lesikar   report writing basicsLesikar   report writing basics
Lesikar report writing basics
 
Basics (Reports Writing 2)
Basics (Reports Writing 2)Basics (Reports Writing 2)
Basics (Reports Writing 2)
 
10 Best Practices for Tableau Dashboard Design: Data Exploration and Actionab...
10 Best Practices for Tableau Dashboard Design: Data Exploration and Actionab...10 Best Practices for Tableau Dashboard Design: Data Exploration and Actionab...
10 Best Practices for Tableau Dashboard Design: Data Exploration and Actionab...
 
Basics (Reports Writing)
Basics (Reports Writing)Basics (Reports Writing)
Basics (Reports Writing)
 
Basic principles of writing a report
Basic principles of writing a reportBasic principles of writing a report
Basic principles of writing a report
 
Mango: Successful grant management for NGOs
Mango: Successful grant management for NGOsMango: Successful grant management for NGOs
Mango: Successful grant management for NGOs
 
14 Ways to Share Results with Donors
14 Ways to Share Results with Donors14 Ways to Share Results with Donors
14 Ways to Share Results with Donors
 
Report writing
Report writingReport writing
Report writing
 
Ppt on Report Writing
Ppt on  Report WritingPpt on  Report Writing
Ppt on Report Writing
 
Repot writing ppt
Repot writing pptRepot writing ppt
Repot writing ppt
 
REPORT WRITTING
REPORT WRITTINGREPORT WRITTING
REPORT WRITTING
 

Similar a SQL PASS BAC - 60 reporting tips in 60 minutes

Similar a SQL PASS BAC - 60 reporting tips in 60 minutes (20)

SQL Server Tips & Tricks
SQL Server Tips & TricksSQL Server Tips & Tricks
SQL Server Tips & Tricks
 
SQL Pass Architecture SQL Tips & Tricks
SQL Pass Architecture SQL Tips & TricksSQL Pass Architecture SQL Tips & Tricks
SQL Pass Architecture SQL Tips & Tricks
 
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...
 
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLBit...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLBit...Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLBit...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLBit...
 
Tools and Tips For Data Warehouse Developers (SQLSaturday Slovenia)
Tools and Tips For Data Warehouse Developers (SQLSaturday Slovenia)Tools and Tips For Data Warehouse Developers (SQLSaturday Slovenia)
Tools and Tips For Data Warehouse Developers (SQLSaturday Slovenia)
 
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSat...
 
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (24 Hou...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (24 Hou...Tools and Tips: From Accidental to Efficient Data Warehouse Developer (24 Hou...
Tools and Tips: From Accidental to Efficient Data Warehouse Developer (24 Hou...
 
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 20197 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
 
Building better SQL Server Databases
Building better SQL Server DatabasesBuilding better SQL Server Databases
Building better SQL Server Databases
 
SQL Tutorial for Marketers
SQL Tutorial for MarketersSQL Tutorial for Marketers
SQL Tutorial for Marketers
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
 
Streaming Transformations - Putting the T in Streaming ETL
Streaming Transformations - Putting the T in Streaming ETLStreaming Transformations - Putting the T in Streaming ETL
Streaming Transformations - Putting the T in Streaming ETL
 
Big Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft AzureBig Data Analytics in the Cloud with Microsoft Azure
Big Data Analytics in the Cloud with Microsoft Azure
 
SQL Server Dev ToolKit
SQL Server Dev ToolKitSQL Server Dev ToolKit
SQL Server Dev ToolKit
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
 
Data Warehouse Design and Best Practices
Data Warehouse Design and Best PracticesData Warehouse Design and Best Practices
Data Warehouse Design and Best Practices
 
Salesforce Development Best Practices
Salesforce Development Best PracticesSalesforce Development Best Practices
Salesforce Development Best Practices
 
How Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill SetsHow Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill Sets
 
Ultimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitUltimate Free SQL Server Toolkit
Ultimate Free SQL Server Toolkit
 
Microsoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMicrosoft Azure Big Data Analytics
Microsoft Azure Big Data Analytics
 

Más de Ike Ellis

Más de Ike Ellis (20)

Storytelling with Data with Power BI
Storytelling with Data with Power BIStorytelling with Data with Power BI
Storytelling with Data with Power BI
 
Storytelling with Data with Power BI.pptx
Storytelling with Data with Power BI.pptxStorytelling with Data with Power BI.pptx
Storytelling with Data with Power BI.pptx
 
Build a modern data platform.pptx
Build a modern data platform.pptxBuild a modern data platform.pptx
Build a modern data platform.pptx
 
Data Modeling on Azure for Analytics
Data Modeling on Azure for AnalyticsData Modeling on Azure for Analytics
Data Modeling on Azure for Analytics
 
Migrate a successful transactional database to azure
Migrate a successful transactional database to azureMigrate a successful transactional database to azure
Migrate a successful transactional database to azure
 
Data modeling trends for analytics
Data modeling trends for analyticsData modeling trends for analytics
Data modeling trends for analytics
 
Relational data modeling trends for transactional applications
Relational data modeling trends for transactional applicationsRelational data modeling trends for transactional applications
Relational data modeling trends for transactional applications
 
Power bi premium
Power bi premiumPower bi premium
Power bi premium
 
Move a successful onpremise oltp application to the cloud
Move a successful onpremise oltp application to the cloudMove a successful onpremise oltp application to the cloud
Move a successful onpremise oltp application to the cloud
 
Pass 2018 introduction to dax
Pass 2018 introduction to daxPass 2018 introduction to dax
Pass 2018 introduction to dax
 
Pass the Power BI Exam
Pass the Power BI ExamPass the Power BI Exam
Pass the Power BI Exam
 
Slides for PUG 2018 - DAX CALCULATE
Slides for PUG 2018 - DAX CALCULATESlides for PUG 2018 - DAX CALCULATE
Slides for PUG 2018 - DAX CALCULATE
 
Introduction to DAX
Introduction to DAXIntroduction to DAX
Introduction to DAX
 
14 Habits of Great SQL Developers
14 Habits of Great SQL Developers14 Habits of Great SQL Developers
14 Habits of Great SQL Developers
 
14 Habits of Great SQL Developers
14 Habits of Great SQL Developers14 Habits of Great SQL Developers
14 Habits of Great SQL Developers
 
Dive Into Azure Data Lake - PASS 2017
Dive Into Azure Data Lake - PASS 2017Dive Into Azure Data Lake - PASS 2017
Dive Into Azure Data Lake - PASS 2017
 
Survey of the Microsoft Azure Data Landscape
Survey of the Microsoft Azure Data LandscapeSurvey of the Microsoft Azure Data Landscape
Survey of the Microsoft Azure Data Landscape
 
Azure DocumentDB 101
Azure DocumentDB 101Azure DocumentDB 101
Azure DocumentDB 101
 
Hadoop for the Absolute Beginner
Hadoop for the Absolute BeginnerHadoop for the Absolute Beginner
Hadoop for the Absolute Beginner
 
Continuous integration sql in the city
Continuous integration sql in the cityContinuous integration sql in the city
Continuous integration sql in the city
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

SQL PASS BAC - 60 reporting tips in 60 minutes

Notas del editor

  1. update sales.customers set contacttitle = null where custid in ('59', '66', '78', '15') use tsql2012 select * from sales.customers select ContactName + ' - ' + ContactTitle + ', ' + City as GreetingLine from sales.customers select isnull(ContactName, '') + ' - ' + isnull(ContactTitle, '') + ', ' + isnull(City, '') as GreetingLine from sales.customers select concat(ContactName, ' ', ContactTitle, ' ', City) as GreetingLine from sales.customers
  2. use tsql2012 select * from sales.orders select custid, freight from sales.orders select custid, freight, sum(freight) as totalFreight from sales.orders select custid, sum(freight) as totalFreight from sales.orders group by custid select custid, freight, sum(freight) as totalFreight from sales.orders group by custid select custid, freight, sum(freight) as totalFreight from sales.orders group by custid, freight --we're skipping subqueries, because they look ugly and --it insults me aesthetically ;with FreightTotal as ( select custid, sum(freight) as totalFreight from sales.orders group by custid ) select o.custid , o.freight , ft.totalFreight as totalFreight from sales.orders o join FreightTotal ft on o.custid = ft.custid --BIG IMPROVEMENT --query can be executed independantly --Can be reused, like this ;with FreightTotal as ( select custid, sum(freight) as totalFreight from sales.orders group by custid ) select o.custid , o.freight , ft.totalFreight as totalFreight , o.freight /ft.totalfreight * 100 as FreightPercentage from sales.orders o join FreightTotal ft on o.custid = ft.custid --but remember our original thought process select custid, freight, sum(freight) as totalFreight from sales.orders --here's a windowing function select custid , freight , sum(freight) over (partition by custid) as totalFreight from sales.orders --and reusing it is not that big of a deal select custid , freight , sum(freight) over (partition by custid) as totalFreight , freight / sum(freight) over (partition by custid) * 100 as FreightPercentage from sales.orders
  3. SELECT * FROM (SELECT urgency, name, phone, location, department, cc, status, case_manager, ip, case_manager_ei d, id_problem, id_problem_type, eid_author, title, body, date_created, date_modified FROM problems AS main INNER JOIN (SELECT id_problem as t_urgency_id_problem, node_value AS urgency FROM problem_nodes WHERE node_name = "urgency")t_urgency ON t_urgency.t_urgency_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_name_id_problem, node_value AS name FROM problem_nodes WHERE node_name = "name")t_name ON t_name.t_name_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_phone_id_problem, node_value AS phone FROM problem_nodes WHERE node_name = "phone")t_phone ON t_phone.t_phone_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_location_id_problem, node_value AS location FROM problem_nodes WHERE node_name = "location")t_location ON t_location.t_location_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_department_id_problem, node_value AS department FROM problem_nodes WHERE node_name = "department")t_department ON t_department.t_department_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_cc_id_problem, node_value AS cc FROM problem_nodes WHERE node_name = "cc")t_cc ON t_cc.t_cc_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_status_id_problem, node_value AS status FROM problem_nodes WHERE node_name = "status")t_status ON t_status.t_status_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_case_manager_id_problem, node_value AS case_manager FROM problem_nodes WHERE node_name = "case_manager")t_case_manager ON t_case_manager.t_case_manager_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_ip_id_problem, node_value AS ip FROM problem_nodes WHERE node_name = "ip")t_ip ON t_ip.t_ip_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_case_manager_eid_id_problem, node_value AS case_manager_eid FROM problem_nodes WHERE node_name = "case_manager_eid") t_case_manager_eid ON t_case_manager_eid.t_case_manager_eid_id_problem = main.id_problem)t
  4. ;with FirstMondays as ( Select DateAdd(day, (9-DatePart(weekday, DateAdd(Month, 1+DateDiff(Month, 0, '12/1/2009'), 0)))%7, DateAdd(Month, 1+DateDiff(Month, 0, '12/1/2009'), 0)) as FirstMonday union all select DateAdd(day, (9-DatePart(weekday, DateAdd(Month, 1+DateDiff(Month, 0, FirstMonday), 0)))%7, DateAdd(Month, 1+DateDiff(Month, 0, FirstMonday), 0)) from FirstMondays where firstMonday <= '12/1/2010' ) select * from FirstMondays use adventureworksdw2012 select EnglishMonthName, min(datekey) from dimdate where englishdaynameofweek = 'monday' and calendaryear = '2010' group by EnglishMonthName, MonthNumberOfYear order by MonthNumberOfYear
  5. create table t1 (col1 varchar(100)) insert into t1 (col1) values ('1') ,('2') ,('3') ,('ike') ,('1') ,('2') ,('3') ,('ike') , ('1') ,('2') ,('3') ,('ike') select cast(col1 as int) from t1 select try_cast(col1 as int) from t1
  6. SELECT SQL#.Date_Format('2009-12-03 12:45:56.345', 'D', '') -- Thursday, December 03, 2009 SELECT SQL#.Date_Format('2009-12-03 12:45:56.345', 'D', 'de') SELECT SQL#.Date_Format('2009-12-03 12:45:56.345', 'D', 'fr-fr') -- jeudi 3 décembre 2009 SELECT SQL#.Date_Format('2009-12-03 12:45:56.345', 'dd', '') -- 03 SELECT SQL#.Date_Format('2009-12-03 12:45:56.345', 'dd-MMM', '') SELECT SQL#.Date_Format('2009-12-03 12:45:56.345', 'tt', 'ja-jp') -- 午後 SELECT SQL#.Math_IsPrime(12318237133333)
  7. SELECT * FROM sales.Customers WHERE custid = <custid, int, 0> SELECT * FROM sales.customers c JOIN sales.orders o ON c.custid = o.custid WHERE c.custid = <custid, int, 0> AND o.orderdate > <orderdate, datetime, '1/1/2015'>