21 Nov 2016 Patrycja Dybka SQL JOINs Explained with Venn Diagrams A SQL JOIN is a method to retrieve data from two or more database tables. This article presents a basic overview of what data from a particular SQL join will look like. A popular way of understanding SQL joins is to visualize them using Venn diagrams, so each example have corresponding Venn diagram, appropriate SELECT statement and the result table. There are a few major kinds of SQL joins: Read more 18 Nov 2016 Patrycja Dybka SQL Subqueries The article describes what a subquery is and what these useful statements look like. We will cover basic examples with the IN, EXISTS, ANY, and ALL operators, look at subqueries in FROM and WHERE clauses, and explore the difference between correlated and nested subqueries. First, let’s start with an example database. To present some of these statements we need to have an example table and fill it with some data. Read more 20 Oct 2016 Patrycja Dybka How to Tackle SQL NULLs: COALESCE function It's inevitable that some data in the database has no value what in SQL is represented by the NULL keyword. "No value" here is different from zero, false, or an empty string (but with exceptions! In Oracle database, NULL is the same as string of zero length). During playing with the database, treating NULLs are becoming more and more troublesome, therefore MySQL standard provides help with some of the functions, like COALESCE. Read more 2 Aug 2016 Patrycja Dybka The History of Slonik, the PostgreSQL Elephant Logo Logos are powerful. What better way to remind people of a product than an eye-catching, memorable symbol? With that in mind, today we’ll answer the question ‘Why did PostgreSQL choose an elephant for its logo?’ Every product or company has its logo – something that identifies and encapsulates the essence of their brand. In time, it practically becomes the brand: can you imagine McDonald’s without its golden arches? What if the Coca-Cola logo was suddenly done in purple block print? Read more 14 Jan 2015 Patrycja Dybka Oracle Collations: Binary and Linguistic Collations Oracle bases its language support on the values of parameters that begin with NLS. These parameters specify, for example, how to display currency or how the name of a day is spelled. The table below presents some of the NLS parameters. By using one of them, NLS_SORT, we can specify the sort method (binary or linguistic) for both SQL WHERE clause operations and NLSSORT function operations. Option Name Description NLS_LANG The current language, territory, and database character set, which are determined by session-wide globalization parameters. Read more 5 Jan 2015 Patrycja Dybka PostgreSQL Collations List Collations Collations in PostgreSQL are available depending on operating system support. For example, in Ubuntu type the following to list the names of the available collations: locale -a The same locales are available in PostgreSQL in the pg_collation catalog (mappings from an SQL name to operating system locale categories). select * from pg_collation; collname | collnamespace | collowner | collencoding | collcollate | collctype -----------+---------------+-----------+--------------+-------------+------------ default | 11 | 10 | -1 | | C | 11 | 10 | -1 | C | C POSIX | 11 | 10 | -1 | POSIX | POSIX C. Read more 29 Oct 2014 Patrycja Dybka Basic Date and Time Functions in MS SQL Server As a follow up to our article “The Most Useful Date and Time Functions in Oracle Database”, let’s review what date and time functions look like in MS SQL Server. Let’s start with functions that extract a year, month and day from a given date. declare @dt date = '2014-10-20' select year (@dt) as year, month (@dt) as month, day (@dt) as day SQL Server uses GETDATE() and SYSDATETIME() to get a current date and time. Read more 21 Oct 2014 Patrycja Dybka The Most Useful Date and Time Functions Date and time functions and formats are quite different in various databases. In this article, let's review the most common functions that manipulates dates in an Oracle database. The function SYSDATE() returns a 7 byte binary data element whose bytes represents: century, year, month, day, hour, minute, second It's important to know that select sysdate from dual in SQL*Plus gives the same result as select to_char(sysdate) from dual because SQL*Plus binds everything into character strings so it can print it. Read more 3 Sep 2014 Patrycja Dybka S.Q.L or Sequel: How to Pronounce SQL? Have you ever thought about how to pronounce SQL? It's something that confuses a lot of people, even though SQL has been a big part of the tech industry for decades. Should you spell it out as “S-Q-L” or just say “sequel”? Let's dig into this debate and see if we can figure it out. SQL has been around for decades and supports a many billion dollar market. However, many people still struggle with just how to pronounce the term SQL. Read more 26 Aug 2014 Patrycja Dybka SQL vs. Mongo query In recent times, NoSQL databases have become a hot topic and have gained a crowd of advocates. Indeed, when NoSQL database started to arise, SQL-to-NoSQL converters arose with them as well. But unfortunately, thanks to the code conversion possibility, SQL supporters gained unquestionable evidence that in many cases the good, old SQL is much easier to use. Especially when it comes to queries. I performed a quick Google search and found plenty of nice converter tools. Read more