228 votes
Accepted

Is adding the ‘tbl’ prefix to table names really a problem?

I once had a table and it was shiny and beautiful. It held all the financial transactions for an organization. And then we started loading data into it. In the current month, they can state and ...
billinkc's user avatar
  • 15.9k
158 votes

Is adding the ‘tbl’ prefix to table names really a problem?

Brent here (the guy you're referring to in the question). The reason I tell you not to add tbl to the front of your table names is the same reason I'd say not to add child to the front of your child'...
Brent Ozar's user avatar
121 votes

Is adding the ‘tbl’ prefix to table names really a problem?

This is a very subjective argument, but here is my take: the tbl prefix is useless. How many scenarios are you looking at code and you can't tell if something's a table or something else? What ...
Aaron Bertrand's user avatar
44 votes

Is adding the ‘tbl’ prefix to table names really a problem?

It is a terrible practice. tbl tbl_ Table_ t_ ... seen them all in production. One of the products I'm currently working with has half of the tables named tbl_whatever, and the other half named "...
Philᵀᴹ's user avatar
  • 31.8k
37 votes

Is adding the ‘tbl’ prefix to table names really a problem?

comDon't verListen prepTo adjThose adjOther nouPeople. proYou auxShould advAlways verUse nouPrefixes prepWith proYour adjTable nouNames. proI auxHave advEven verStarted gerUsing proThem prepIn ...
ErikE's user avatar
  • 4,305
32 votes

Is there a generic term for tables and views?

Postgres (and also relational algebra) calls them relations - tabular things of rows and columns that you can query from. This includes tables, views, materialised views, temporary tables, or even ...
Bergi's user avatar
  • 504
22 votes

Is adding the ‘tbl’ prefix to table names really a problem?

Using a prefix like this is known as Hungarian Notation. It's premise is simple: you can determine what something is by how it's named. This is particularly common in programming languages, especially ...
phyrfox's user avatar
  • 361
21 votes
Accepted

Is there a generic term for tables and views?

A "thing with columns and rows" is a relation. This is the word Codd used in his seminal paper, starting the RDBM revolution. A "thing that can change but retain its identity" - is ...
fdreger's user avatar
  • 691
19 votes

Delete rows older than x days without locking table

You need to delete rows in batches to avoid lock escalation. Lock escalation happens when SQL Server switches from row or page locks to locking the entire table. Lock escalation conserves memory ...
Stephen Morris - Mo64's user avatar
16 votes
Accepted

What is a “transition table" in Postgres?

You know how there are OLD and NEW record-variables for FOR EACH ROW triggers? Transition tables are the FOR EACH STATEMENT equivalents. They're tables with the old and new tuples, so your triggers ...
Craig Ringer's user avatar
  • 56.4k
15 votes
Accepted

Ordering of table is based on Clustered index or non clustered primary key?

Unless you explicitly state a desired order using an ORDER BY clause you can not guarantee the order that data will be presented in response to a query. Without an ORDER BY clause the engine is free ...
David Spillett's user avatar
15 votes

column {table_name} of relation {table_name} does not exist SQL state: 42703

You cannot (and need not) use table aliases (or tablename qualified column names) in the SET clause of an UPDATE. This even makes sense, as you can only update a single table in a single UPDATE, so ...
András Váczi's user avatar
13 votes

Is adding the ‘tbl’ prefix to table names really a problem?

I've read a few blog posts like this or this (there's quite a few) after I inherited my first SQL Server Instance and noticed many objects where prefixed, I wanted to start developing new ones with a ...
Nelson's user avatar
  • 1,689
13 votes

What is a “transition table" in Postgres?

I really like Craig's explanation of the feature. The SQL-2011 Spec defines them in the context of a trigger as "a collection of rows being deleted, inserted or replaced is known as a transition table....
Evan Carroll's user avatar
  • 63.1k
12 votes

Is adding the ‘tbl’ prefix to table names really a problem?

Yes, adding a prefix that denotes the type of the object is a problem, and unnecessary. Because, Sometimes objects begin life as something but will end up becoming something else. (e.g. table tblXxx ...
sampathsris's user avatar
11 votes

Is adding the ‘tbl’ prefix to table names really a problem?

tl;dr It (very likely) adds redundant information, leading to cognitive overhead, and should therefore be removed. Context is a wonderful thing, especially in computer systems. Out of context you ...
l0b0's user avatar
  • 403
11 votes

Is adding the ‘tbl’ prefix to table names really a problem?

One of the features of a relational database management system is that it separates the logical presentation of information to clients from the physical storage. The former is columns in a rowset. The ...
Michael Green's user avatar
10 votes
Accepted

At what point is a (disk-based) table removed from memory after data is read from it?

This is a complicated topic, much of which is covered in this Microsoft Docs article. To answer a couple of points: Are (disk-based, so no Hekaton) tables persisted in memory for longer than the ...
Josh Darnell's user avatar
  • 29.2k
10 votes

Should I split semantically almost identical entities into different tables?

To me it sounds like you have one entity / object, a Note. You can have a NoteType or IsNoteShared field to differentiate between if it's a personal or shared note. Or you can even get away without an ...
J.D.'s user avatar
  • 37.5k
9 votes

Is adding the ‘tbl’ prefix to table names really a problem?

This has been covered many times, but probably most famously by Joe Celko, an American SQL and relational database expert. I've personally been on the receiving end of one of his rants online (felt ...
John Bell's user avatar
  • 252
9 votes

What does GRANT CONTROL on a schema do in MSSQL?

To see what CONTROL on schema brings to you, create a test user without any permission, grant CONTROL on schema to it and check what permissions he has after it: create user test; grant control on ...
sepupic's user avatar
  • 11k
8 votes
Accepted

Difference between a schema and a database in db2

This simple question has caused an unusual amount of debate, and I feel compelled to quote an authoritative source. The database stores all data in tables that are related to one another. ...
mustaccio's user avatar
  • 26k
8 votes
Accepted

SQL - Many-to-Many relationship with same table and with relationship constraint

If I understand your scenario description correctly, you want to manage two different facts, so you should have (a) one table to store product data that is independent of sellers and (b) another table ...
MDCCL's user avatar
  • 8,520
8 votes

Is adding the ‘tbl’ prefix to table names really a problem?

There are lots of answers here that I agree with that tell you that this isn't a very valuable naming convention. For those people who aren't convinced by the other answers I'm going to try to ...
Erik's user avatar
  • 4,771
8 votes
Accepted

Sqlite Create Table with Check column from other table

Looking up a value from another table would require a subquery, but the documentation says: The expression of a CHECK constraint may not contain a subquery. There is no such restriction on a ...
CL.'s user avatar
  • 5,213
8 votes
Accepted

How do I CREATE a table only if it doesn't exist in PostgreSQL?

It needs to check if the table already exists and create only if not found? There is no standards-compliant method at all, but PostgreSQL 9.1+ supports a common extension with the IF NOT EXISTS ...
Evan Carroll's user avatar
  • 63.1k
8 votes
Accepted

SQLServer - treat table as index

What you ask for is what we call a "clustered index" in the SQL Server world. The clustered index is the data. I.e., the b-tree for the index is you actual table data. A clustered index don'...
Tibor Karaszi's user avatar
7 votes
Accepted

What should I set my table_definition_cache to?

I hope this links can help you to decide your fine tunning. A little later my answer, sorry about. I could resolve some problems in 5.5 MySQL version using this information. Here: you can check how to ...
Cepxio's user avatar
  • 124
7 votes
Accepted

Why am I receiving the identity insert error even after explicitly setting IDENTITY_INSERT ON and using a column list?

Add a column list to your code: SET IDENTITY_INSERT SomeCoolDatabase.BoringOldSchema.TableWithIdentityColumn ON INSERT INTO SomeCoolDatabase.BoringOldSchema.TableWithIdentityColumn (...
Cowthulhu's user avatar
  • 277

Only top scored, non community-wiki answers of a minimum length are eligible