Professional Documents
Culture Documents
Adv Database Environment
Adv Database Environment
2023
Advanced Database
Applications
1
4.11.2023
2
4.11.2023
3
4.11.2023
Relational DBMS
• Represent data as two-dimensional tables
• Each table contains data on entity and attributes
• Table: grid of columns and rows
• Rows (tuples): Records for different entities
• Fields (columns): Represents attribute for entity
• Key field: Field used to uniquely identify each record
• Primary key: Field in table used for key fields
• Foreign key: Primary key used in second table as look-up
field to identify records from original table
4
4.11.2023
5
4.11.2023
Capabilities of Database
Management Systems
• Data definition capability
• Data dictionary
• Querying and reporting
• Data manipulation language
• Structured Query Language (SQL)
• Many DBMS have report generation capabilities for creating
polished reports (SQL Server)
6
4.11.2023
Designing Databases
• Conceptual design vs. physical design
• Normalization
• Streamlining complex groupings of data to minimize redundant data
elements and awkward many-to-many relationships
• Referential integrity
• Rules used by RDBMS to ensure relationships between tables remain
consistent
• Entity-relationship diagram
• A correct data model is essential for a system serving the business
well
7
4.11.2023
8
4.11.2023
9
4.11.2023
10
4.11.2023
Data Mining
• Finds hidden patterns, relationships in datasets
• Example: customer buying patterns
• Infers rules to predict future behavior
• Types of information obtainable from data mining:
• Associations
• Sequences
• Classification
• Clustering
• Forecasting
11
4.11.2023
12
4.11.2023
13
4.11.2023
Database Applications
SQL Server
14
4.11.2023
Data Types
Introduction
SQL data types define the type of value that can be stored in a table column. For example, if
you want a column to store only integer values, you can define its data type as INT.
29
30
15
4.11.2023
We can use
float924) as ISO
Real −3.40E+38 3.40E+38 4 bytes
synonym
for real.
Its storage
It is an
depends upon
Approximate-
value (n)
number data
Float(n) −1.79E+308 1.79E+308 N(1-24) ->4
types.
bytes
The default
N(25-53)->8
value of N is
bytes
16
4.11.2023
Char(n) 0 characters 8000 characters N bytes 1. It provides a fixed-width character data type.
n bytes + 2 bytes ~ We should avoid using this data type unless required
Varchar (max) 0 characters 2^31 chars
2 GB due to its huge storage requirement.
17
4.11.2023
Nchar 0 characters 4000 characters 2 times n bytes It is a Unicode string of fixed width.
Nvarchar 0 chars 4000 Chars 2 times n bytes Nvarchar is a Unicode string of variable width.
18
4.11.2023
There are few data types as well that can be used as per the requirement:
•Cursor: It is useful for variables or stored procedure OUTPUT parameter referencing to a cursor
•Rowversion: It returns automatically generated, unique binary numbers within a database
•Hierarchyid: it is a system data type with variable length. We use it to represent a position
in a hierarchy
•Uniqueidentifier: It provides 16 bytes GUID
•XML: It is a special data type for storing the XML data in SQL Server tables
•Spatial Geometry type: We can use this for representing data in a flat (Euclidean) coordinate
system
•Spatial Geography Types: We can use Spatial Geography type for storing ellipsoidal (round-
earth) data, such as GPS latitude and longitude coordinates. It represents data in a round-earth
coordinate system
•Table: It is a special data type useful for storing result set temporarily in a table-valued function.
We can use data from this for processing later. It can be used in functions, stored procedures, and
batches
19