Lecture

Column Naming & Conventions

Consistent and clear naming makes SQL databases easier to understand, maintain, and scale—especially when working with a team.

In this lesson, you will learn how to name columns and tables effectively.


General Best Practices

Follow these best practices to ensure clarity and consistency when naming columns and tables in SQL.

Use a single naming convention throughout

Choose one convention and apply it to all columns and tables in your database.

Snake case uses lowercase letters with underscores to separate words.

It is widely used because it is easy to read, type, and keep consistent.

Snake case example
CREATE TABLE clients_info ( id INT PRIMARY KEY, name TEXT, contact_number TEXT, created_at DATE );

PascalCase capitalizes the first letter of each word.

It can be more common in certain programming environments, but is less common in SQL.

Pascal case example
CREATE TABLE ClientsInfo ( Id INT PRIMARY KEY, Name TEXT, ContactNumber TEXT, CreatedAt DATE );

Tip: snake_case is the most popular convention in SQL because it improves readability and avoids case sensitivity issues in many database systems.


Avoid reserved SQL keywords

Don't use words like SELECT, WHERE, or ORDER as column or table names:

Avoid using order as a table name
-- Avoid this CREATE TABLE order (...);

Use descriptive names

Use names that describe the data they contain.

For example, client_id is better than id because it is more descriptive.

Using client_id instead of id
CREATE TABLE clients ( client_id INT PRIMARY KEY, name TEXT, contact_number TEXT, created_at DATE );

Well-Named Table Example

The example below shows a well-named table.

Client orders schema example
CREATE TABLE client_orders ( order_id INT PRIMARY KEY, client_id INT, order_total REAL, placed_at DATE );

Good naming makes it easier to understand queries at a glance, avoid errors and confusion, and keep the database consistent over time.

Quiz
0 / 1

Which column name follows snake_case?

StudentID

FullName

student_id

full name

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Tables

Execution Result