20 May 2021 Martyna Sławińska What’s the Difference Between UNIQUE and DISTINCT in SQL? We use the words unique and distinct interchangeably in our day-to-day life. However, these words play very different roles in SQL. Let’s find out what is so different about them and how we can use them in SQL. Despite the words unique and distinct being synonyms, they cover very different things in SQL. The UNIQUE keyword in SQL plays the role of a database constraint; it ensures there are no duplicate values stored in a particular column or a set of columns. Read more 27 Apr 2021 Martyna Sławińska What Is the Benefit of Foreign Keys in SQL? What is a foreign key and why is it so important in relational databases? Learn all the details about foreign keys in this article. One of relational databases’ key features is the ability to link data stored in different tables. These links, called references, essentially act as connections between tables. They are created using the FOREIGN KEY constraint on table columns. In this article, we’ll learn what the FOREIGN KEY constraint does in SQL. Read more 26 Feb 2021 Martyna Sławińska MS SQL Server vs. PostgreSQL: Which to Choose? Choosing the DBMS you will use for a new project is a very important and difficult decision. Two popular choices are MS SQL Server and PostgreSQL. To help you decide which would be best for you, I'll compare their features, list pros and cons, and give you some examples. Your selection of database management system (DBMS) depends on the type of business or project you're implementing. First, you need to know: Read more 4 Feb 2021 Martyna Sławińska What Is a Unique Constraint in SQL? To ensure the uniqueness of data in a database, we use the SQL UNIQUE constraint. In this article, we’ll discuss how, when, and why to implement it. The idea of a unique constraint is not unique to SQL; it’s a familiar concept in real life, although we probably call it something else! For example, think of ID numbers. There can be only one social security number (SSN) per person and each one must be unique. Read more 8 Jan 2021 Martyna Sławińska What Is Auto-Increment in SQL? In this article, we’ll learn the basics of the auto-increment feature of SQL: what it is and how to use it efficiently. One of the many features offered by SQL is auto-increment. It allows us to automatically generate values in a numeric column upon row insertion. You could think of it as an automatically supplied default value – the next number in a number sequence – that’s generated when the row is inserted. Read more 11 Dec 2020 Martyna Sławińska What is an SQL View? A view is a well-known feature in SQL. It allows you to create a virtual table based on an SQL query referring to other tables in the database. A view stores an SQL query that is executed whenever you refer to the view. This is a convenient way to get the desired data because it is easier to run a query stored in a view than to type a query from scratch. Read more 19 Nov 2020 Martyna Sławińska What Is a SQL Constraint? What are SQL constraints? When and why should you use them? We give examples of common constraints and demonstrate how to apply them. When you’re creating a relational database, you often want to impose certain restrictions on some columns. For example, a column containing a social security number should store only unique values; a column containing a date of birth should not be null, or left empty. These conditions can be ensured by using SQL constraints. Read more 13 Oct 2020 Martyna Sławińska What Is a Self Join in SQL? Explaned With 7 Examples The self join is a popular special case of the SQL JOIN. While most JOINs link two or more tables with each other to present their data together, a self join links a table to itself. This is usually done by joining a table to itself just once within a SQL query, but it is possible to do so multiple times within the same query. Typically, each table in a database stores a specific type of information. Read more 2 Oct 2020 Martyna Sławińska A Comprehensive Introduction to Window Functions in MySQL Do a deep dive into the working principles, syntax, and applications of various MySQL window functions. There are many open source databases you could choose; MySQL is consistently one of the most popular. But until 2018, there was no provision for including window functions in MySQL. Fortunately, all that has changed – starting from MySQL 8.0, SQL window functions were now available to MySQL users. Please note that window functions are available only in MySQL 8. Read more «« « 1 2 3 » »»