0

When I look at Microsoft's sample AdventureWorks database, I see the table names follow a pattern such as:

[Person].[Address]

Does this kind of specification differ from a normal pattern such as:

PersonAddress

Is it only for readability or is there some other point to it?

disasterkid
  • 6,948
  • 25
  • 94
  • 179
  • 1
    Refer this. http://stackoverflow.com/questions/9917196/meaning-of-square-brackets-in-ms-sql-table-designer – Saravana Kumar Dec 10 '14 at 12:58
  • 2
    The [Person] is not a table name, but it is the schema's name which contains the table. [SQL SERVER – Importance of Database Schemas in SQL Server by Pinal Dave](http://blog.sqlauthority.com/2009/09/07/sql-server-importance-of-database-schemas-in-sql-server/) – Pred Dec 10 '14 at 12:59
  • 1
    Using different schema names to organize related database objects is a best practice for databases that contain many objects. The schema name can be leveraged as a namespace do differentiate and categorize objects. It is generally best to explicitly specify a schema name even if objects are all in the same schema (default dbo) in order to improve performance of cache lookups. – Dan Guzman Dec 10 '14 at 13:36

1 Answers1

1

It's SchemaName.TableName

So [Person].[Address] != PersonAddress

Instead it'll be Person.Address

The [] are optional, they exist because if you have special characters, or a reserve word in the object name, you will not be able to call the object without them.

For example select last name from people; is not going to work,

instead you need select [last name] from people;

You can find more information here.

Arun
  • 941
  • 6
  • 13