Reading Time: 3 minutesThere is an interesting factoid you should know when it comes to working with foreign key constraints in SQL Server. Normally, foreign key constraints are linked to a Primary Key column in a parent table Take a look at the following Books and BookSales tables: CREATE TABLE Books ( BookID Continue Reading
Data Definition Language
How to make a column NOT NULL in SQL Server: Explained with Examples
Reading Time: 3 minutesYou may find yourself needing the change the definition of a table or column from time-to-time while working as a database professional. One change you may need to make is changing a column from nullable to non nullable. It may have been decided that we actually don’t want NULL to appear Continue Reading
Difference between unique constraints and primary key constraints: Answered with examples
Reading Time: 4 minutesA primary key constraint and a unique constraint are both meant to enforce uniqueness in column(s). Since that’s true, it begs the question: What’s the difference? In this very brief tutorial, we’ll discuss the two main differences between primary key constraints and unique constraints. Difference # 1: Primary key constraints Continue Reading
How long can a table name be? Learn this “factoid” and more!
Reading Time: 2 minutesThere are many, many details one can learn about Microsoft SQL Server over a very long career in data science. This blog, with over 120 posts, only begins to scratch the surface! In this weeks tutorial, I’d like to talk about just a few unique factoids you might find interesting: Continue Reading
SQL Server DROP IF EXISTS: Explained with Examples
Reading Time: 4 minutesIn SQL Server version 2016, Microsoft introduced an extremely handy tool called DROP IF EXISTS to make our database development lives so must easier. In this very brief tutorial, we’ll walk through the syntax of the DROP IF EXISTS tool and show you a few examples of how to use Continue Reading
How to drop a constraint in SQL Server: Explained with Examples
Reading Time: 4 minutesIt’s very easy to drop a constraint on a column in a table. This is something you might need to do if you find yourself needing to drop the column, for example. SQL Server simply will not let you drop a column if that column has any kind of constraint Continue Reading
How to drop a column in SQL Server: Explained with Examples
Reading Time: 4 minutesKnowing how to make modifications to the definition of a table is very important when it comes to developing Microsoft SQL Server databases. The task of deleting a column is very straightforward. In this very brief tutorial, we’ll discuss how to drop a column from a Microsoft SQL Server table. Continue Reading
How to find a SQL Server column name: Run this one simple query!
Reading Time: 3 minutesIf you have a particularly large database, finding a specific column might be a bit of a challenge. Maybe you don’t recall exactly what the column name is, and you’re not sure what table it belongs to. Luckily, Microsoft SQL Server has some build in system tables that can help Continue Reading
How to reseed an IDENTITY value in SQL Server: A guide for beginners
Reading Time: 5 minutesThe IDENTITY property is one of the most useful tools available to us in Microsoft SQL Server. We basically use it to automatically populate an integer column with a new value on inserts. It’s a great way to let SQL Server manage the integer values placed in a column so Continue Reading
UNIQUEIDENTIFIER: Explained for Beginners
Reading Time: 7 minutesThere are several ways we can guarantee unique values in our primary key columns in our SQL Server tables. One data type we can use to store unique values is the UNIQUEIDENTIFER. In this very brief tutorial, we’ll talk about what the SQL Server UNIQUEIDENTIFIER data type is and how Continue Reading