SlideShare a Scribd company logo
1 of 16
Download to read offline
8th of October 2014 
Zen SQL 
Best practices to query and database design 
by Clément Prévost
8th of October 2014 
The Zen way to SQL 
● State of the art 
● Readability best practices: 
a. Database schema 
b. Query
8th of October 2014 
State of the art 
● ORM (Doctrine, ActiveRecord, ...) 
○ Hides the database schema and queries, follow your 
applicative coding best practices 
● Query Builder (ZendDbSql, …) 
○ Hides the queries, not the schema 
● Raw (Migration scripts, performance critical task, 
Analytics) 
○ DIY
8th of October 2014 
The Zen way to SQL 
● State of the art 
● Readability best practices: 
a. Database schema 
b. Query
a) Database schema best practices 
8th of October 2014 
A. KISS 
○ Beware of overengineering 
○ Don’t let optimizations get in the way of simplicity 
B. Explicitness is the key 
○ Ban abbreviations, “status” column and add 
comments 
C. Your business WILL evolve, same with your schema 
○ Never be afraid to refactor, rename and move stuff 
around
8th of October 2014 
Case study: Database schema BP
8th of October 2014 
1 
3 
2 
1 
2 
3 
3
8th of October 2014 
The Zen way to SQL 
● State of the art 
● Readability best practices: 
a. Database schema 
b. Query
8th of October 2014 
b) Query best practices 
A. Comments and documentation, Avoid deep nesting, 
Reuse external libraries 
B. Know your enemy: Long vs. complex queries 
C. Tools: IDE, Database specificity, SQL capabilities
8th of October 2014
8th of October 2014
8th of October 2014
8th of October 2014 
Key things to remember 
● Work it step by step 
○ Have a perfect schema, then work on beautiful 
queries 
● Know your tools, learn advanced SQL 
● You already know how 
○ Good coding practices also apply to SQL (queries 
AND schema)
8th of October 2014 
Questions ? 
For online questions, please leave a comment on the article.
8th of October 2014 
Join the community ! 
(in Paris) 
Social networks : 
● Follow us on Twitter : https://twitter.com/steamlearn 
● Like us on Facebook : https://www.facebook.com/steamlearn 
SteamLearn is an Inovia initiative : inovia.fr 
You wish to be in the audience ? Contact us at 
learn@steamhouse.fr
8th of October 2014 
Sources 
1. http://www.slideshare.net/Samuel90/software-development-vs-software-maintenance 
2. http://code.tutsplus.com/tutorials/top-15-best-practices-for-writing-super-readable-code--net- 
8118 
3. http://www.postgresql.org/docs/9.3/static/view-pg-available-extensions.html 
4. http://postgres-bits.herokuapp.com/ 
5. http://www.postgresql.org/docs/9.3/static/index.html

More Related Content

Viewers also liked

Steam Learn: Introduction to RDBMS indexes
Steam Learn: Introduction to RDBMS indexesSteam Learn: Introduction to RDBMS indexes
Steam Learn: Introduction to RDBMS indexesinovia
 
Steam Learn: How to write good tests
Steam Learn: How to write good testsSteam Learn: How to write good tests
Steam Learn: How to write good testsinovia
 
Steam Learn: Email deliverability
Steam Learn: Email deliverabilitySteam Learn: Email deliverability
Steam Learn: Email deliverabilityinovia
 
Steam Learn: Cheat sheet for Vim
Steam Learn: Cheat sheet for VimSteam Learn: Cheat sheet for Vim
Steam Learn: Cheat sheet for Viminovia
 
Steam Learn: Introduction to NoSQL with MongoDB
Steam Learn: Introduction to NoSQL with MongoDBSteam Learn: Introduction to NoSQL with MongoDB
Steam Learn: Introduction to NoSQL with MongoDBinovia
 
Steam Learn: Speedrun et TAS
Steam Learn: Speedrun et TASSteam Learn: Speedrun et TAS
Steam Learn: Speedrun et TASinovia
 
Steam Learn: An introduction to Redis
Steam Learn: An introduction to RedisSteam Learn: An introduction to Redis
Steam Learn: An introduction to Redisinovia
 
Steam Learn: Javascript and OOP
Steam Learn: Javascript and OOPSteam Learn: Javascript and OOP
Steam Learn: Javascript and OOPinovia
 

Viewers also liked (8)

Steam Learn: Introduction to RDBMS indexes
Steam Learn: Introduction to RDBMS indexesSteam Learn: Introduction to RDBMS indexes
Steam Learn: Introduction to RDBMS indexes
 
Steam Learn: How to write good tests
Steam Learn: How to write good testsSteam Learn: How to write good tests
Steam Learn: How to write good tests
 
Steam Learn: Email deliverability
Steam Learn: Email deliverabilitySteam Learn: Email deliverability
Steam Learn: Email deliverability
 
Steam Learn: Cheat sheet for Vim
Steam Learn: Cheat sheet for VimSteam Learn: Cheat sheet for Vim
Steam Learn: Cheat sheet for Vim
 
Steam Learn: Introduction to NoSQL with MongoDB
Steam Learn: Introduction to NoSQL with MongoDBSteam Learn: Introduction to NoSQL with MongoDB
Steam Learn: Introduction to NoSQL with MongoDB
 
Steam Learn: Speedrun et TAS
Steam Learn: Speedrun et TASSteam Learn: Speedrun et TAS
Steam Learn: Speedrun et TAS
 
Steam Learn: An introduction to Redis
Steam Learn: An introduction to RedisSteam Learn: An introduction to Redis
Steam Learn: An introduction to Redis
 
Steam Learn: Javascript and OOP
Steam Learn: Javascript and OOPSteam Learn: Javascript and OOP
Steam Learn: Javascript and OOP
 

Similar to Steam Learn: Zen SQL

OpenStack Doc Overview for Boot Camp
OpenStack Doc Overview for Boot CampOpenStack Doc Overview for Boot Camp
OpenStack Doc Overview for Boot CampAnne Gentle
 
Asp.net Training at NCrypted Learning Center
Asp.net Training at NCrypted Learning CenterAsp.net Training at NCrypted Learning Center
Asp.net Training at NCrypted Learning CenterNCrypted Learning Center
 
Azure Machine Learning
Azure Machine LearningAzure Machine Learning
Azure Machine LearningDavide Mauri
 
Opening Keynote - DrupalCamp St. Louis 2014
Opening Keynote - DrupalCamp St. Louis 2014Opening Keynote - DrupalCamp St. Louis 2014
Opening Keynote - DrupalCamp St. Louis 2014Brad Nowak
 
Coursera amazon cloudsearch presentation
Coursera amazon cloudsearch presentation Coursera amazon cloudsearch presentation
Coursera amazon cloudsearch presentation Michael Bohlig
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with DrupalPantheon
 
Object Oriented Programming in Swift Ch0 - Encapsulation
Object Oriented Programming in Swift Ch0 - EncapsulationObject Oriented Programming in Swift Ch0 - Encapsulation
Object Oriented Programming in Swift Ch0 - EncapsulationChihyang Li
 
Which Freaking Database Should I Use?
Which Freaking Database Should I Use?Which Freaking Database Should I Use?
Which Freaking Database Should I Use?Great Wide Open
 
How to Use WordPress in Unexpected Ways: Headless CMS, VR, and Augmented Real...
How to Use WordPress in Unexpected Ways: Headless CMS, VR, and Augmented Real...How to Use WordPress in Unexpected Ways: Headless CMS, VR, and Augmented Real...
How to Use WordPress in Unexpected Ways: Headless CMS, VR, and Augmented Real...WP Engine
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaJohn Nestor
 
Cheat sheets for coding
Cheat sheets for codingCheat sheets for coding
Cheat sheets for codingIsaac Oteyo
 
Data Day Texas 2017: Scaling Data Science at Stitch Fix
Data Day Texas 2017: Scaling Data Science at Stitch FixData Day Texas 2017: Scaling Data Science at Stitch Fix
Data Day Texas 2017: Scaling Data Science at Stitch FixStefan Krawczyk
 
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)Jernej Kavka (JK)
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPAGil Fink
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveDragos Manolescu
 
Scaffolding the Generation of Machine Learning Models with SciRise
Scaffolding the Generation of Machine Learning Models with SciRiseScaffolding the Generation of Machine Learning Models with SciRise
Scaffolding the Generation of Machine Learning Models with SciRiseaneeshabakharia
 
data-scientist-learning-path.pptx
data-scientist-learning-path.pptxdata-scientist-learning-path.pptx
data-scientist-learning-path.pptxsandipkishore
 
Scalable Ensemble Machine Learning @ Harvard Health Policy Data Science Lab
Scalable Ensemble Machine Learning @ Harvard Health Policy Data Science LabScalable Ensemble Machine Learning @ Harvard Health Policy Data Science Lab
Scalable Ensemble Machine Learning @ Harvard Health Policy Data Science LabSri Ambati
 
Developing Arcturis - Our game-based learning system using FuelPHP - silicong...
Developing Arcturis - Our game-based learning system using FuelPHP - silicong...Developing Arcturis - Our game-based learning system using FuelPHP - silicong...
Developing Arcturis - Our game-based learning system using FuelPHP - silicong...Christopher Cubos
 

Similar to Steam Learn: Zen SQL (20)

OpenStack Doc Overview for Boot Camp
OpenStack Doc Overview for Boot CampOpenStack Doc Overview for Boot Camp
OpenStack Doc Overview for Boot Camp
 
Asp.net Training at NCrypted Learning Center
Asp.net Training at NCrypted Learning CenterAsp.net Training at NCrypted Learning Center
Asp.net Training at NCrypted Learning Center
 
Azure Machine Learning
Azure Machine LearningAzure Machine Learning
Azure Machine Learning
 
Opening Keynote - DrupalCamp St. Louis 2014
Opening Keynote - DrupalCamp St. Louis 2014Opening Keynote - DrupalCamp St. Louis 2014
Opening Keynote - DrupalCamp St. Louis 2014
 
Coursera amazon cloudsearch presentation
Coursera amazon cloudsearch presentation Coursera amazon cloudsearch presentation
Coursera amazon cloudsearch presentation
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with Drupal
 
Object Oriented Programming in Swift Ch0 - Encapsulation
Object Oriented Programming in Swift Ch0 - EncapsulationObject Oriented Programming in Swift Ch0 - Encapsulation
Object Oriented Programming in Swift Ch0 - Encapsulation
 
Which Freaking Database Should I Use?
Which Freaking Database Should I Use?Which Freaking Database Should I Use?
Which Freaking Database Should I Use?
 
How to Use WordPress in Unexpected Ways: Headless CMS, VR, and Augmented Real...
How to Use WordPress in Unexpected Ways: Headless CMS, VR, and Augmented Real...How to Use WordPress in Unexpected Ways: Headless CMS, VR, and Augmented Real...
How to Use WordPress in Unexpected Ways: Headless CMS, VR, and Augmented Real...
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
 
Ask your users
Ask your usersAsk your users
Ask your users
 
Cheat sheets for coding
Cheat sheets for codingCheat sheets for coding
Cheat sheets for coding
 
Data Day Texas 2017: Scaling Data Science at Stitch Fix
Data Day Texas 2017: Scaling Data Science at Stitch FixData Day Texas 2017: Scaling Data Science at Stitch Fix
Data Day Texas 2017: Scaling Data Science at Stitch Fix
 
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to Reactive
 
Scaffolding the Generation of Machine Learning Models with SciRise
Scaffolding the Generation of Machine Learning Models with SciRiseScaffolding the Generation of Machine Learning Models with SciRise
Scaffolding the Generation of Machine Learning Models with SciRise
 
data-scientist-learning-path.pptx
data-scientist-learning-path.pptxdata-scientist-learning-path.pptx
data-scientist-learning-path.pptx
 
Scalable Ensemble Machine Learning @ Harvard Health Policy Data Science Lab
Scalable Ensemble Machine Learning @ Harvard Health Policy Data Science LabScalable Ensemble Machine Learning @ Harvard Health Policy Data Science Lab
Scalable Ensemble Machine Learning @ Harvard Health Policy Data Science Lab
 
Developing Arcturis - Our game-based learning system using FuelPHP - silicong...
Developing Arcturis - Our game-based learning system using FuelPHP - silicong...Developing Arcturis - Our game-based learning system using FuelPHP - silicong...
Developing Arcturis - Our game-based learning system using FuelPHP - silicong...
 

More from inovia

10 tips for Redux at scale
10 tips for Redux at scale10 tips for Redux at scale
10 tips for Redux at scaleinovia
 
10 essentials steps for kafka streaming services
10 essentials steps for kafka streaming services10 essentials steps for kafka streaming services
10 essentials steps for kafka streaming servicesinovia
 
Redux at scale
Redux at scaleRedux at scale
Redux at scaleinovia
 
DocuSign's Road to react
DocuSign's Road to reactDocuSign's Road to react
DocuSign's Road to reactinovia
 
API Gateway: Nginx way
API Gateway: Nginx wayAPI Gateway: Nginx way
API Gateway: Nginx wayinovia
 
Kafka: meetup microservice
Kafka: meetup microserviceKafka: meetup microservice
Kafka: meetup microserviceinovia
 
Microservice: starting point
Microservice:  starting pointMicroservice:  starting point
Microservice: starting pointinovia
 
Correlation id (tid)
Correlation id (tid)Correlation id (tid)
Correlation id (tid)inovia
 
Meetic back end redesign - Meetup microservices
Meetic back end redesign - Meetup microservicesMeetic back end redesign - Meetup microservices
Meetic back end redesign - Meetup microservicesinovia
 
Security in microservices architectures
Security in microservices architecturesSecurity in microservices architectures
Security in microservices architecturesinovia
 
Building a Secure, Performant Network Fabric for Microservice Applications
Building a Secure, Performant Network Fabric for Microservice ApplicationsBuilding a Secure, Performant Network Fabric for Microservice Applications
Building a Secure, Performant Network Fabric for Microservice Applicationsinovia
 
Microservices vs SOA
Microservices vs SOAMicroservices vs SOA
Microservices vs SOAinovia
 
CQRS, an introduction by JC Bohin
CQRS, an introduction by JC BohinCQRS, an introduction by JC Bohin
CQRS, an introduction by JC Bohininovia
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Designinovia
 
Oauth2, open-id connect with microservices
Oauth2, open-id connect with microservicesOauth2, open-id connect with microservices
Oauth2, open-id connect with microservicesinovia
 
You probably don't need microservices
You probably don't need microservicesYou probably don't need microservices
You probably don't need microservicesinovia
 
Api Gateway - What's the use of an api gateway?
Api Gateway - What's the use of an api gateway?Api Gateway - What's the use of an api gateway?
Api Gateway - What's the use of an api gateway?inovia
 
Steam Learn: Asynchronous Javascript
Steam Learn: Asynchronous JavascriptSteam Learn: Asynchronous Javascript
Steam Learn: Asynchronous Javascriptinovia
 

More from inovia (18)

10 tips for Redux at scale
10 tips for Redux at scale10 tips for Redux at scale
10 tips for Redux at scale
 
10 essentials steps for kafka streaming services
10 essentials steps for kafka streaming services10 essentials steps for kafka streaming services
10 essentials steps for kafka streaming services
 
Redux at scale
Redux at scaleRedux at scale
Redux at scale
 
DocuSign's Road to react
DocuSign's Road to reactDocuSign's Road to react
DocuSign's Road to react
 
API Gateway: Nginx way
API Gateway: Nginx wayAPI Gateway: Nginx way
API Gateway: Nginx way
 
Kafka: meetup microservice
Kafka: meetup microserviceKafka: meetup microservice
Kafka: meetup microservice
 
Microservice: starting point
Microservice:  starting pointMicroservice:  starting point
Microservice: starting point
 
Correlation id (tid)
Correlation id (tid)Correlation id (tid)
Correlation id (tid)
 
Meetic back end redesign - Meetup microservices
Meetic back end redesign - Meetup microservicesMeetic back end redesign - Meetup microservices
Meetic back end redesign - Meetup microservices
 
Security in microservices architectures
Security in microservices architecturesSecurity in microservices architectures
Security in microservices architectures
 
Building a Secure, Performant Network Fabric for Microservice Applications
Building a Secure, Performant Network Fabric for Microservice ApplicationsBuilding a Secure, Performant Network Fabric for Microservice Applications
Building a Secure, Performant Network Fabric for Microservice Applications
 
Microservices vs SOA
Microservices vs SOAMicroservices vs SOA
Microservices vs SOA
 
CQRS, an introduction by JC Bohin
CQRS, an introduction by JC BohinCQRS, an introduction by JC Bohin
CQRS, an introduction by JC Bohin
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Oauth2, open-id connect with microservices
Oauth2, open-id connect with microservicesOauth2, open-id connect with microservices
Oauth2, open-id connect with microservices
 
You probably don't need microservices
You probably don't need microservicesYou probably don't need microservices
You probably don't need microservices
 
Api Gateway - What's the use of an api gateway?
Api Gateway - What's the use of an api gateway?Api Gateway - What's the use of an api gateway?
Api Gateway - What's the use of an api gateway?
 
Steam Learn: Asynchronous Javascript
Steam Learn: Asynchronous JavascriptSteam Learn: Asynchronous Javascript
Steam Learn: Asynchronous Javascript
 

Recently uploaded

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Recently uploaded (20)

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

Steam Learn: Zen SQL

  • 1. 8th of October 2014 Zen SQL Best practices to query and database design by Clément Prévost
  • 2. 8th of October 2014 The Zen way to SQL ● State of the art ● Readability best practices: a. Database schema b. Query
  • 3. 8th of October 2014 State of the art ● ORM (Doctrine, ActiveRecord, ...) ○ Hides the database schema and queries, follow your applicative coding best practices ● Query Builder (ZendDbSql, …) ○ Hides the queries, not the schema ● Raw (Migration scripts, performance critical task, Analytics) ○ DIY
  • 4. 8th of October 2014 The Zen way to SQL ● State of the art ● Readability best practices: a. Database schema b. Query
  • 5. a) Database schema best practices 8th of October 2014 A. KISS ○ Beware of overengineering ○ Don’t let optimizations get in the way of simplicity B. Explicitness is the key ○ Ban abbreviations, “status” column and add comments C. Your business WILL evolve, same with your schema ○ Never be afraid to refactor, rename and move stuff around
  • 6. 8th of October 2014 Case study: Database schema BP
  • 7. 8th of October 2014 1 3 2 1 2 3 3
  • 8. 8th of October 2014 The Zen way to SQL ● State of the art ● Readability best practices: a. Database schema b. Query
  • 9. 8th of October 2014 b) Query best practices A. Comments and documentation, Avoid deep nesting, Reuse external libraries B. Know your enemy: Long vs. complex queries C. Tools: IDE, Database specificity, SQL capabilities
  • 13. 8th of October 2014 Key things to remember ● Work it step by step ○ Have a perfect schema, then work on beautiful queries ● Know your tools, learn advanced SQL ● You already know how ○ Good coding practices also apply to SQL (queries AND schema)
  • 14. 8th of October 2014 Questions ? For online questions, please leave a comment on the article.
  • 15. 8th of October 2014 Join the community ! (in Paris) Social networks : ● Follow us on Twitter : https://twitter.com/steamlearn ● Like us on Facebook : https://www.facebook.com/steamlearn SteamLearn is an Inovia initiative : inovia.fr You wish to be in the audience ? Contact us at learn@steamhouse.fr
  • 16. 8th of October 2014 Sources 1. http://www.slideshare.net/Samuel90/software-development-vs-software-maintenance 2. http://code.tutsplus.com/tutorials/top-15-best-practices-for-writing-super-readable-code--net- 8118 3. http://www.postgresql.org/docs/9.3/static/view-pg-available-extensions.html 4. http://postgres-bits.herokuapp.com/ 5. http://www.postgresql.org/docs/9.3/static/index.html