T-SQL 101: #8 What are tables in SQL Server?

I mentioned previously that databases hold collections of information about related things. But what are these "things"? Well, that's what the tables are.

Tables are the most basic objects that live in a database. They hold information about one type of thing. You might call the things "entities" but it's not 100% accurate. It's the same problem if you call them "objects". They aren't really objects. They basically are just "things" that we're storing information about, like employees, books, cinemas, products, and more. ANSI SQL called them "relations".

Viewing Tables

Object Explorer in SQL Server Management Studio (SSMS), can let you drill down to see the existing tables in a database. If you did that for the PopkornKraze database, you'd see this:

I prefer to see tables given plural names (as they are storing information about all the products, or all the cinemas, not just one) but that's a near-religious argument for some people, that I won't get into today. The one exception that I have for plural names is if a table will only ever hold a single row. In that case, I make it singular. Regardless, you will see plenty of sites where they have used singular names throughout, and I can work with that if I need to.


Columns are where the actual details are held. If you called the things that tables hold information about "entities", columns would be closer to "attributes" i.e. it's the things that we know about the entity.

Importantly, columns also have data types and other characteristics. Data types are useful because they restrict the values that can be stored in a column. So a salary might be a decimal value, not just a string, and the data type stops us trying to put "ABC" into a salary column.

A single row in a table, holds information about one specific entity.  If you right-click a table name in Object Explorer, you'll have an option to select a number of rows from the table. If you did that for the dbo.Cinemas table, you'd see an image similar to this:

In that, you can see that the first row has all the information about one cinema, the next row has all the same information about another cinema, and so on.

It's also worth noting that many older books on databases might use words like "records" and "fields" but for ANSI SQL databases, we talk about "rows" and "columns" instead, and these are the words you should use.

Learning T-SQL

It's worth your while becoming proficient in SQL. If you'd like to learn a lot about T-SQL in a hurry, our Writing T-SQL Queries for SQL Server course is online, on-demand, and low cost.

Leave a Reply

Your email address will not be published. Required fields are marked *