Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cabeeb's avatar

Database Naming Conventions

FIRST POST!

Ok, I'm building an application in Laravel that includes people, and seating for these people broken up into tables (eg 20 people split up across seats at 3 dinner tables). It also includes a way to arbitrarily group people for organizational purposes (eg create a a group of just the founding members).

My initial thought was to name those two models Tables and Groups respectively. But I'm afraid of potential SQL conflicts with those specific words. Is there a standard for naming arbitrary groupings like that? Peoplegroup or Seatgroup or something like that? Or will Tables and Groups be ok? Thanks!

0 likes
4 replies
davielee's avatar

Hey @cabeeb,

Having tables named tables and groups will not be a problem. However, if you were to name the table table (or group) you would run into a problem without properly escaping the table name (in raw sql). See below.

// Will not work
SELECT * FROM table;

// Will work
SELECT * FROM `table`;

Like I mentioned though, tables and groups are perfectly valid table names.

cabeeb's avatar

Great, thanks @craigpaul! And I'm assuming it won't cause an issue with having Models and objects named "Table" and "Group"? Is there some kind of convention or best practice for naming groups of objects like that?

davidangel's avatar

You might also keep in mind how you (and possibly other developers) will use these terms in your code. The terms table and group are fairly abstract, and there's nothing wrong with naming things more specifically if it helps your code read better.

davielee's avatar

^ Exactly what @davidangel said. There is no problem naming them that, but if there are better terms that are more descriptive, IMO, those should be used. That being said, if Table and Group are descriptive enough for your app, then use them :)

Please or to participate in this conversation.