0% found this document useful (0 votes)
17 views8 pages

Database Docu

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views8 pages

Database Docu

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Database - A database is an integrated collection of logically related records or files consolidated into a

common pool that provides data for one or more multiple uses.

A Database Management System (DBMS) - consists of software that organizes the storage of data.

1.1 RDBMS Components

A Relational Database Management System (DBMS) consists of the following components:

 Interface drivers - A user or application program initiates either schema modification or content

modification. These drivers are built on top of SQL. They provide methods to prepare statements,

execute statements, fetch results, etc.

 SQL engine - This component interprets and executes the SQL query. It comprises three major

components (compiler, optimizer, and execution engine).

 Transaction engine - Transactions are sequences of operations that read or write database elements,

which are grouped together.

 Relational engine - Relational objects such as Table, Index, and Referential integrity constraints are

implemented in this component.

 Storage engine - This component stores and retrieves data records. It also provides a mechanism to

store metadata and control information such as undo logs, redo logs, lock tables, etc.

1.2 Data warehouse

A data warehouse stores data from current and previous years data extracted from the various operational

databases of an organization.

1.3 Relational Database

A relational database matches data using common characteristics found within the data set.

1.4 Real-time databases

A real-time database is a processing system designed to handle workloads whose state may change

constantly.
1.5 NoSQL Databases

The next generation of database systems is known as NoSQL databases and document-oriented databases.

NoSQL databases are often very fast, do not require fixed table schemas.

1.6 Database Management Systems

There are Database Management Systems (DBMS), such as:

 Microsoft SQL Server

 Oracle

 Sybase

 dBase

 Microsoft Access

 MySQL from Sun Microsystems (Oracle)

 DB2 from IBM

 etc.

1.7 MDAC

The Microsoft Data Access Components (MDAC) - is the framework that makes it possible to connect

and communicate with the database.

MDAC includes the following components:

 ODBC (Open Database Connectivity)

 OLE DB

 ADO (ActiveX Data Objects)


1.7.1 ODBC

Open Database Connectivity (ODBC) is a native interface that is accessed through a programming language

that can make calls into a native library. In MDAC this interface is defined as a DLL.

1.7.2 OLE DB

OLE allows MDAC applications access to different types of data stores in a uniform manner.

1.7.3 ADO (ActiveX Data Objects)

ActiveX Data Objects (ADO) is a high level programming interface to OLE DB.

2 Relational Databases

A relational database matches data using common characteristics found within the data set. The resulting

groups of data are organized and are much easier for people to understand.

2.1 Tables

The basic units in a database are tables and the relationship between them. Strictly, a relational database is a

collection of relations (frequently called tables).

2.2 Unique Keys and Primary Key

In relational database design, a unique key or primary key is a candidate key to uniquely identify each row

in a table. A unique key or primary key comprises a single column or set of columns.

2.3 Foreign Key

In the context of relational databases, a foreign key is a referential constraint between two tables.
2.4 Views

In database theory, a view consists of a stored query accessible as a virtual table composed of the result set

of a query.

Views can provide advantages over tables:

 Views can represent a subset of the data contained in a table.

 Views can join and simplify multiple tables into a single virtual table.

 Views can act as aggregated tables, where the database engine aggregates data (sum, average etc)

and presents the calculated results as part of the data.

 Views can hide the complexity of data; for example a view could appear as Sales2000 or Sales2001,

transparently partitioning the actual underlying table.

 Views take very little space to store; the database contains only the definition of a view, not a copy

of all the data it presents.

 Views can limit the degree of exposure of a table or tables to the outer world.

2.5 Functions

In SQL databases, a user-defined function provides a mechanism for extending the functionality of the

database server by adding a function that can be evaluated in SQL statements.

2.6 Stored Procedures

A stored procedure is executable code that is associated with, and generally stored in, the database.

2.7 Triggers

A database trigger is procedural code that is automatically executed in response to certain events on a

particular table or view in a database.


3.1 Queries

The most common operation in SQL is the query, which is performed with the declarative SELECT

statement. SELECT retrieves data from one or more tables, or expressions.

 The FROM clause which indicates the table(s) from which data is to be retrieved. The FROM clause

can include optional JOIN subclauses to specify the rules for joining tables.

 The WHERE clause includes a comparison predicate, which restricts the rows returned by the query.

The WHERE clause eliminates all rows from the result set for which the comparison predicate does

not evaluate to True.

 The GROUP BY clause is used to project rows having common values into a smaller set of rows.

GROUP BY is often used in conjunction with SQL aggregation functions or to eliminate duplicate

rows from a result set.

 The HAVING clause includes a predicate used to filter rows resulting from the GROUP BY clause.

Because it acts on the results of the GROUP BY clause, aggregation functions can be used in the

HAVING clause predicate.

 The ORDER BY clause identifies which columns are used to sort the resulting data, and in which

direction they should be sorted (options are ascending or descending). Without an ORDER BY

clause, the order of rows returned by an SQL query is undefined.

3.2 Data Manipulation

The Data Manipulation Language (DML) is the subset of SQL used to add, update and delete data.
Acronym CRUD - refers to all of the major functions that need to be implemented in a relational database

application to consider it complete. Each letter in the acronym can be mapped to a standard SQL statement:

Operation SQL

Create INSERT

Read (Retrieve) SELECT

Update UPDATE

Delete (Destroy) DELETE

3.3 Data Definition

The Data Definition Language (DDL) manages table and index structure. The most basic items of DDL are

the CREATE, ALTER, RENAME and DROP statements:

 CREATE creates an object (a table, for example) in the database.

 DROP deletes an object in the database, usually irretrievably.

 ALTER modifies the structure an existing object in various ways-for example, adding a column to an

existing table.

DATA TYPES - Each column in an SQL table declares the type(s) that column may contain. ANSI SQL

includes the following data types.

3.4.1 Character Strings

 CHARACTER(n) or CHAR(n) - fixed-width n-character string, padded with spaces as needed.

 CHARACTER VARYING(n) or VARCHAR(n) - variable-width string with a maximum size of n

characters.

 NATIONAL CHARACTER(n) or NCHAR(n) - fixed width string supporting an international

character set.

 NATIONAL CHARACTER VARYING(n) or NVARCHAR(n) - variable-width NCHAR string.


3.4.2 Bit Strings

 BIT(n) - an array of n bits

 BIT VARYING(n) - an array of up to n bits

3.4.3 Numbers

 INTEGER and SMALLIN

 FLOAT, REAL and DOUBLE PRECISION

 NUMERIC(precision, scale) or DECIMAL(precision, scale)

3.4.4 Date and Time

 DATE

 TIME

 TIMESTAMP

 INTERVAL

4.1 ER Diagram

In software engineering, an Entity-Relationship Model (ERM) is an abstract and conceptual representation

of data.

4.2 Microsoft Visio

Microsoft Visio is a diagramming program for creating different kinds of diagrams. Visio have a template

for creating Database Model Diagrams.

4.3 ERwin

ERwin is a professional database modelling tool. A Community edition is also available for free. The

Community edition is limited to work with max 25 objects.


Microsoft SQL Server - is a relational model database server produced by Microsoft. Its primary query

languages are T-SQL and ANSI SQL.

The Microsoft SQL Server comes in different versions, such as

 SQL Server Developer Edition

 SQL Server Enterprise Edition

 SQL Server Web Edition

 SQL Server Express Edition

5.3 SQL Server Management Studio

SQL Server Management Studio - is a GUI tool included with SQL Server for configuring, managing, and

administering all components within Microsoft SQL Server.

You might also like