Database Concepts

Definition - What does SQL Server mean?
SQL Server is Microsoft's relational database management system (RDBMS). It is a full-featured databse primarily designed to compete against competitors Oracle Database (DB) and MySQL.

Like all major RBDMS, SQL Server supports ANSI SQL, the standard SQL language. However, SQL Server also contains T-SQL, its own SQL implemention. SQL Server Management Studio (SSMS) (previously known as Enterprise Manager) is SQL Server’s main interface tool, and it supports 32-bit and 64-bit environments.

SQL Server is sometimes referred to as MSSQL and Microsoft SQL Server. SQL Server is offered in several editions with different feature set and pricing options to meet a variety of user needs, including the following:

Enterprise: Designed for large enterprises with complex data requirements, data warehousing and Web-enabled databases. Has all the features of SQL Server, and its license pricing is the most expensive.
Standard: Targeted toward small and medium organizations. Also supports e-commerce and data warehousing.

Workgroup: For small organizations. No size or user limits and may be used as the backend database for small Web servers or branch offices.

Express: Free for distribution. Has the fewest number of features and limits database size and users. May be used as a replacement for an Access database.

What Is a Database?
A database, in the most general sense, is an organized collection of data. More specifically, a database is an electronic system that allows data to be easily accessed, manipulated and updated.

In other words, a database is used by an organization as an electronic way to store, manage and retrieve information. The database is one of the cornerstones of enterprise IT, and its ability to organize, process and manage information in a structured and controlled manner is the key to many aspects of modern business efficiency.

Tables:
The table is the basic data-storage unit in a relational database. Tables consist of columns and rows. The columns are the attributes or qualities that we want to express, while the rows hold the actual data, with one (or no) items per row.

Relationship:
Relationships are THE reason why relational databases work so well. If you only learn one concept about databases, this is the one to learn. As the name implies, relationships are the very core of relational databases.

In relational databases, a relationship exists between two tables when one of them has a foreign key that references the primary key of the other table. (More on foreign and primary keys in a bit).

Row:
A row, also called a record, represents a set of data about a specific item. Every record in a table has exactly the same structure, but of course different data. Think of the rows in an Excel spreadsheet - the concept of rows in a database is very similar. Each row in a table consists of distinct data items, with one (or zero) items for each column of the table. Rows are also called tuples, although this term is not very common.

Primary Key:
A primary key is a special column or combination of columns that uniquely identifies each record (row) in the table. The primary key column must be unique for each row, and must not contain any nulls (non-values). So, for example, to identify yourself in various databases belonging to various U.S. government departments, a unique identifier, the Social Security number, is assigned and used.

Foreign Key:
We cannot talk about the yin of primary keys without the yang of foreign keys. The two go hand-in-hand. A primary key uniquely defines a record, while a foreign key is used to reference the same record from another table.

SQL:
Structured Query Language (SQL) is the de facto language used for the management and manipulation of data in relational databases. SQL can be used to query, insert, update and modify data. All major relational databases support SQL, which makes life much easier for database administrators (DBAs), who have to support databases on several different platforms.

SQL Server Data Types

String types:
Data typeDescriptionStorage
char(n)Fixed width character string. Maximum 8,000 charactersDefined width
varchar(n)Variable width character string. Maximum 8,000 characters2 bytes + number of chars
varchar(max)Variable width character string. Maximum 1,073,741,824 characters2 bytes + number of chars
textVariable width character string. Maximum 2GB of text data4 bytes + number of chars
ncharFixed width Unicode string. Maximum 4,000 charactersDefined width x 2
nvarcharVariable width Unicode string. Maximum 4,000 characters
nvarchar(max)Variable width Unicode string. Maximum 536,870,912 characters
ntextVariable width Unicode string. Maximum 2GB of text data
bitAllows 0, 1, or NULL
binary(n)Fixed width binary string. Maximum 8,000 bytes
varbinaryVariable width binary string. Maximum 8,000 bytes
varbinary(max)Variable width binary string. Maximum 2GB
imageVariable width binary string. Maximum 2GB


No comments:

Post a Comment