4 8 SQL Server Basics Material
4 8 SQL Server Basics Material
Data Integrity
Data integrity in SQL Server is enhanced by the use of 'triggers' which can be applied
whenever a record is added, updated or deleted. This occurs at the table level and cannot
thus be forgotten about, ignored or bypassed by the client machine. For example audit
processes cannot be avoided (accidentally or deliberately) with this scenario.
Performance
With Access all tables involved in a form, report or a query are copied across the
network from the server to the client's machine. The tables are then processed and
filtered to generate the required data.
Network Traffic
As can be seen from the previous section, network traffic is greatly reduced in a
client/server scenario, often by many orders of magnitude. This both improves network
reliability (by reducing collisions, etc.) and also improves the performance of the
network for other software (as there is less traffic on the network).
Low Bandwidth
This occurs when you are accessing your database over a connection that only supports
low data speeds, which, for all practical situations, means anything other than a LAN.
Dial-up
Allowing remote salesmen, off-site workers, home workers, out of hours users and
the like to dial into the network over the normal telephone lines.
WAN
If you want to link more than one site to a database then typically you would use a
WAN (Wide Area Network).
Internet
A database that is being run over the Internet needs to be stable, scalable, able to
handle heavy loads and capable of coping with failed connections; none of which are
usually associated with file server database architectures.
Wireless LAN
These are increasingly popular and are usually fine for accessing a spreadsheet or
Word document where a wired solution is inconvenient or is just not practical.
However file/server databases do not usually work well over most wireless links due to
Scalability
A file server system such as Access is designed for small workgroups and is scalable to
perhaps 10 concurrent clients.
2. SQL SERVER COMPONENTS
Component Purpose
1 Database Engine Supports Real-time, Rapid Processing (OLTP) Databases
2 Analysis Services Supports Analytical Databases for Big Data Analysis, Forecasts
(OLAP)
3 Integration Supports the Design of Databases for Old, Historical Data (DWH)
Services
4 Reporting Services For end to end implementation of Report Design, Storage, Access.
5 Machine Learning Python and R
Used to implement Machine Learning operations for Data Scientists
6 Polybase Used to process / execute SQL Server Queries in Hadoop
7 Replication Included inside Database Engine Component
Used for Automated Data Recovery (DR) and Load Balancing
8 Full Text Search Included inside Database Engine Component
Used for faster search of Text (character) data.
Resource
o Purpose - The Resource database is responsible for physically storing all of the
SQL Server system objects. This database has been created to improve the
upgrade and rollback of SQL Server system objects with the ability to
overwrite only this database.
o Additional Information
Introduced in SQL Server 2005 to help manage the upgrade and
rollback of system objects
Prior to SQL Server 2005 the system related data was stored in
the master database
The database ID for the Resource database is 32767
The Resource database does not have an entry in
master.sys.databases
TempDB
o Purpose - Temporary database to store temporary tables (#temptable or
##temptale), table variables, cursors, work tables, row versioning, indexes sorted
in TempDB, etc. Each time the SQL Server instance is restarted tempdb is auto
created.
Model
User defined tables, stored procedures, user defined data types, etc can be created in
the Model database and will exist in all future user defined databases
The database configurations such as the recovery model for the Model
database are applied to future user defined databases
MSDB
User defined tables, stored procedures, user defined data types, etc can be created in
the Model database and will exist in all future user defined databases
The database configurations such as the recovery model for the Model
database are applied to future user defined databases
4. VERSIONS COMPARISON CHART
SQL SERVER 2019 SQL SERVER 2017 SQL SERVER 2016
DB ENGINE
FULL TEXT SEARCH
REPLICATION
COLUMNSTORE
DATA SCIENCE (R)
DATA SCIENCE (PYTHON) X
POLYBASE X
SCALEOUT-MASTER X
In Memory OLTP X
LINUX SUPPORT X
AZURE INTEGRATION X
QUERY STORE X
IN-MEMORY TABLES X
TEMPORAL TABLES X
POWER BI REPORT DBs X
AZURE BI INTEGRATION X
Real Time Operational X X
Analytics
Persistent Memory X X
(PMEM) Devices
Resumable Online Index X X
Big Data Clusters X X
Enterprise Cost Yet to be Released 14500 USD 12750 USD
5. TEMORARY TABLES
SQL Server provides two types of temp tables based on the behavior and scope of the table.
These are:
Local Temp Table
Global Temp Table
NETWORK PROTOCOLS
SHARED MEMORY USED FOR CLIENT - SERVER COMMUNICATION WITH THE SAME OS
NAMED PIPES USED FOR CLIENT - SERVER COMMUNICATION OVER LAN
TCP/IP TRANSMISSION CONTROL PROTOCOL or INTERNET PROTOCOL
USED FOR CLIENT - SERVER COMMUNICATION OVER INTERNET
VIA VIRTUAL INTERFACE FOR CLIENT - SERVER COMMUNICATION.
DATA TYPES
DATA TYPE FROM TO
bigint -9,223,372,036,854,770,000 9,223,372,036,854,770,000
int -2,147,483,648 2,147,483,647
smallint -32,768 32,767
tinyint 0 255
bit 0 1
decimal 1E+38 10^38 -1
float -1.79E + 308 1.79E + 308
real -3.40E + 38 3.40E + 38
datetime Jan 1, 1753 31-Dec-99
smalldatetime 1-Jan-00 6-Jun-79
date Stores a date like June 30, 1991
time Stores a time of day like 12:30 P.M.
char Maximum length of 8,000 characters.
varchar Maximum of 8,000 characters.(Variable-length non-Unicode data).
varchar(max) Maximum length of 231characters, Variable-length non-Unicode data
text Variable-length non-Unicode data with a maximum length of
2,147,483,647
sysname The sysname data type is used for storing object names.
xml Stores xml formateddata.maxi 2gb
cursor Stores a reference to a cursor used for database operations
uniqueidentifier Stores a golbally unique identifier(guid)
image To store images. binary format.
binary(n) To store media information, binary data