Home » Tag Archives: SQL (page 3)

Tag Archives: SQL

How to Fill Sparse Data With the Previous Non-Empty Value in SQL

software-development-2-logo

The following is a very common problem in all data related technologies and we’re going to look into two very lean, SQL-based solutions for it: How do I fill the cells of a sparse data set with the “previous non-empty value”? The problem The problem is really simple and I’m reusing the example provided by Stack Overflow user aljassi in ...

Read More »

SQL GROUP BY and Functional Dependencies: A Very Useful Feature

software-development-2-logo

Relational databases define the term “Functional Dependency” as such (from Wikipedia): In relational database theory, a functional dependency is a constraint between two sets of attributes in a relation from a database. In other words, functional dependency is a constraint that describes the relationship between attributes in a relation. In SQL, functional dependencies appear whenever there is a unique constraint ...

Read More »

How to Find the Longest Consecutive Series of Events in SQL

software-development-2-logo

A very interesting problem that can be solved very easily with SQL is to find consecutive series of events in a time series. But what is a consecutive series of events in a time series? Take Stack Overflow, for example. Stack Overflow has a cool reputation system that uses badges to reward certain behaviour. As a social website, they encourage ...

Read More »

NoSQL vs. SQL: Choosing a Data Management Solution

software-development-2-logo

Table Of Contents 1. Introduction 2. Distributed systems: the CAP theorem 3. Relational data stores 3.1. MySQL / MariaDB 3.2. PostgreSQL 3.3. Others 4. Why NoSQL? 5. Key/Value data stores 5.1. DynamoDB 5.2. Memcached 5.3. Redis 5.4. Riak 5.5. Aerospike 5.6. FoundationDB 6. Columnar data stores 6.1. Accumulo 6.2. Cassandra 6.3. HBase 7. Graph data stores 7.1. Neo4J 7.2. Titan ...

Read More »

How to Find the Closest Subset Sum with SQL

software-development-2-logo

I’ve stumbled upon this very interesting question on Stack Overflow, recently. Its title is: [How to] compare a number with sum of subset of numbers In this article, we’ll compare the user’s imperative approach to the extremely elegant (Oracle) SQL approach. We’ll be making use of any combination of these awesome SQL features:   Window functions FIRST and LAST functions, ...

Read More »

Leveraging new features in Drill 1.2 – ANSI SQL Analytic/Window functions

software-development-2-logo

Today we are very excited to announce the latest version of Apache Drill, 1.2,) as part of the MapR distribution. Drill 1.2 packages for MapR can be downloaded http://doc.mapr.com/display/MapR/Apache+Drill+on+MapR You can experiment with the release using MapR sandbox and various hands on tutorials at https://www.mapr.com/products/mapr-sandbox-hadoop/download-sandbox-drill Apache Drill has been gaining significant user adoption and community momentum since its initial Beta ...

Read More »

jOOQ Tuesdays: Markus Winand is on a Modern SQL Mission

software-development-2-logo

Welcome to the jOOQ Tuesdays series. In this series, we’ll publish an article on the third Tuesday every other month where we interview someone we find exciting in our industry from a jOOQ perspective. This includes people who work with SQL, Java, Open Source, and a variety of other related topics. We are excited to talk with Markus Winand in ...

Read More »

The 10 Most Popular DB Engines (SQL and NoSQL) in 2015

software-development-2-logo

About two years ago, we’ve published this post about the 10 most popular DB engines, where we analyzed the data published by Solid IT on their DB Ranking website. In the meantime, the Solid IT measurement system has found to be a credible source, such that the website has also been cited at Gartner, InfoWorld, and many other sources. Comparing ...

Read More »

You Probably don’t Use SQL INTERSECT or EXCEPT Often Enough

software-development-2-logo

When people talk about SQL JOIN, they often use Venn Diagrams to illustrate inclusion and exclusion of the two joined sets: While these Venn diagrams are certainly useful to understand (and remember) SQL JOIN syntax, they’re not entirely accurate, because SQL JOIN is a special type of a cartesian product, the CROSS JOIN. In a cartesian product between two sets ...

Read More »

Don’t Format Dates in SQL. Use the DATE Literal!

software-development-2-logo

I’m seeing people do this all the time. They want to hammer a date or timestamp constant into their SQL query, and the only function they know is the TO_DATE() or TO_TIMESTAMP() date parsing function: SELECT TO_DATE ('20150801', 'yyyymmdd') FROM DUAL; As observed in this Stack Overflow question, for instance: TO_DATE ('20150801', 'yyyymmdd') AS DAY_20150801_TOTAL, TO_DATE ('20150802', 'yyyymmdd') AS DAY_20150802_TOTAL, ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns