Schemas, Identifiers, and Constraints

A schema is a container. It holds database tables. It also has a name. Some example schemas that always exist are dbo, guest, information_schema, and sys. The schema object does not necessarily need to be tied to users in modern SQL Server editions. There is no nesting of schemas. All are top level objects.

Objects in the database need to have identifiers (e.g. names). There are rules to name normal identifiers. They need to have between 1 and 128 characters. The characters can be letters, numbers, @, $, #, and/or _. Regular identifiers cannot be database keywords such as SELECT. They cannot have spaces. And they cannot have special characters other than the ones listed above.

A constraint is a database object. They were previously called "rules" in SQL Server. The constraint name must be unique to the database. If you specify WITH CHECK at time of creation, the constraint will be applied to data that already exists in the table. The syntax of a check constraint is similar to a WHERE clause in a SELECT statement.