The organization of a database involves many different objects. All objects of a database are either physical or logical. The physical objects are related to the organization of the data on the physical device (disk). The Database Engine’s physical … [Read more...] about Creating Database Objects / Create a Database
Data Definition Language - SQL Server 2012
This chapter describes all the Transact-SQL statements concerning data definition language (DDL). The DDL statements are divided into three groups, which are discussed in turn. The first group includes statements that create objects, the second group includes statements that modify the structure of objects, and the third group includes statements that remove objects.
CREATE TABLE: A Basic Form
The CREATE TABLE statement creates a new base table with all corresponding columns and their data types. The basic form of the CREATE TABLE statement is Note - Besides base tables, there are also some special kinds of tables, such as temporary … [Read more...] about CREATE TABLE: A Basic Form
CREATE TABLE and Declarative Integrity Constraints
One of the most important features that a DBMS must provide is a way of maintaining the integrity of data. The constraints, which are used to check the modification or insertion of data, are called integrity constraints. The task of maintaining … [Read more...] about CREATE TABLE and Declarative Integrity Constraints
Referential Integrity (ON DELETE, ON UPDATE)
A referential integrity enforces insert and update rules for the tables with the foreign key and the corresponding primary key constraint. Examples 5.7 and 5.10 (see section "CREATE TABLE and Declarative Integrity Constraints") specify two such … [Read more...] about Referential Integrity (ON DELETE, ON UPDATE)
Creating Other Database Objects (views, index, etc)
A relational database contains not only base tables that exist in their own right but also views, which are virtual tables. The data of a base table exists physically—that is, it is stored on a disk—while a view is derived from one or more base … [Read more...] about Creating Other Database Objects (views, index, etc)
Integrity Constraints and Domains
A domain is the set of all possible legitimate values that columns of a table may contain. Almost all DBMSs use base data types such as INT, CHAR, and DATE to define the set of possible values for a column. This method of enforcing “domain integrity” … [Read more...] about Integrity Constraints and Domains
Altering a Database – ALTER DATABASE statement
The ALTER DATABASE statement changes the physical structure of a database. The Transact-SQL language allows you to change the following properties of a database: Add or remove one or more database filesAdd or remove one or more log filesAdd or … [Read more...] about Altering a Database – ALTER DATABASE statement
Altering a Table – ALTER TABLE statement
The ALTER TABLE statement modifies the schema of a table. The Transact-SQL language allows the following types of alteration: Add or drop one or more new columnsModify column propertiesAdd or remove integrity constraintsEnable or disable … [Read more...] about Altering a Table – ALTER TABLE statement