0% found this document useful (0 votes)
58 views6 pages

4 8 SQL Server Basics Material

SQL Server provides several advantages over other database platforms including improved data integrity through triggers, reduced network traffic through client-server architecture, and scalability. It has various components like the database engine, analysis services, and reporting services. The database engine uses services like authentication and SQL browser service. There are system databases like master, msdb, model and tempdb that serve different purposes. SQL Server 2016-2019 have additional features like PolyBase, Linux support, and in-memory capabilities. Temporary tables in SQL Server can be local or global depending on their scope and behavior.
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)
58 views6 pages

4 8 SQL Server Basics Material

SQL Server provides several advantages over other database platforms including improved data integrity through triggers, reduced network traffic through client-server architecture, and scalability. It has various components like the database engine, analysis services, and reporting services. The database engine uses services like authentication and SQL browser service. There are system databases like master, msdb, model and tempdb that serve different purposes. SQL Server 2016-2019 have additional features like PolyBase, Linux support, and in-memory capabilities. Temporary tables in SQL Server can be local or global depending on their scope and behavior.
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/ 6

SQL SERVER BASICS

Information For your Interviews


1. What are the Advantages of SQL Server 2016 / 2017 / 2019 ?

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.

SERVICES IN SQL SERVER (For Database Engine)


Service Purpose
1 DB Engine Service To design, store, manage, administer SQL Server Databases
2 Full Text Search Service To support Full Text Search Service Component
3 SQL Browser Service To identify Instances when working with SQL Remote Servers

AUTHENTICATION - Communication path B/W SQL Server & end users


AUTHENTICATION MODES:
1. WINDOWS AUTHENTICATION : WINDOWS USERS CAN CONNECT
2. MIXED MODE AUTHENTICATION : WINDOWS USERS & SQL USERS CAN
CONNECT

LOGIN - Windows/Mac/Linux User to connect To SQL Server


LOGIN TYPES:
1. WINDOWS LOGINS : SUPPORTS WINDOWS AUTHENTICATION
2. SQL LOGINS : SUPPORTS MIXED MODE AUTHENTICATION
3. SYSTEM DATABASES
Master
o Purpose - Core system database to manage the SQL Server instance. In SQL
Server, the Master database is the logical repository for the system objects
residing in the sys schema. Prominent Functionality
 Per instance configurations
 Databases residing on the instance
 Files for each database
 Logins
 Linked\Remote servers
 Endpoints

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

Local Temp Table


Local temp tables are only available to the current connection for the user; and they
are automatically deleted when the user disconnects from instances. Local temporary
table name is stared with hash ("#") sign.
CREATE TABLE #TABLE1(COL1 INT, COL2 INT)

Global Temp Table


Global Temporary tables name starts with a double hash ("##"). Once this table has
been created by a connection, like a permanent table it is then available to any user by
any connection. It can only be deleted once all connections have been closed.
CREATE TABLE ##TABLE2(COL1 INT, COL2 INT)
SQL SERVER ARCHITECTURE

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.

DATABASE ENGINE - QUERY PROCESSING ENGINE


PARSER To verify Database Statements and Convert from SQL to Machine Code
QUERY OPTIMIZER To find the best way to execute the Queries
SQL MANAGER To reserve the resources required for Query Execution [Memory, CPU]
DATABASE MANAGER To identify the Tables in the Database File [MDF file]
QUERY EXECUTOR To perform the actual Query Execution.
DATABASE ENGINE - STORAGE ENGINE
TRANSACTION SERVICES To control the SQL operations (auto/manual save)
FILE MANAGER To identify database files (data files, log files)
BUFFER MANAGER To allocate the Memory required for Query Execution
LOCK MANAGER To LOCK OR RESERVE DATABASES, TABLES & COLUMNS

SQLOS [SQL OPERATING SYSTEM] API : APPLICATION PROGRAMMING INTERFACE


MEMORY MANAGER TO ALLOCATE MEMORY FOR SQL SERVER SOFTWARE
BUFFER POOL TO "BUFFER" DATABASE DATA FOR FASTER DATA ACCESS
LOCK MANAGER TO ALLOCATE LOCKS ON DATABASE FILES & EFFICIENT ACCESS
IO MANAGER TO REPORT DATA FILE I/O, LOG FILE I/O [INPUT & OUTPUT]
THREAD SCHEDULER TO "SCHEDULE" / "AUTOMATE" SQL OPERATIONS : JOBS
SYNCHRONIZATION TO AUTOMATE THE PROCESS OF DDL QUERIES
SERVICES Ex: Whenever we create a database, a set of TWO files are auto created.

MDAC MICROSOFT DATA ACCESS COMPONENT.


THIS COMPONENT IS USED FOR CLIENT - SERVER COMMUNICATION
CLR COMMON LANGUAGE RUNTIME. PREDEFINED LIBRARY FILES (DLLs) TO
CONNECT AND OPERATE ON SQL SERVER USING MSBI (SSIS), POWER BI..
LAZY WRITER COMPONENT IS USED TO WRITE THE TABLE DATA INTO MEMORY FIRST
CHECKPOINT INTERNAL PROCESS TO WRITE DATA FROM LOG FILES TO DATA FILES
WAL WRITE AHEAD LOG : USED TO CONTROL LAZY WRITER & CHECKPOINT.

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

table To store table data (array of values)


varbinary(max) variable width binary string,maxi 2gb
nvarchar variable width binary string,max4000char
money -922,337,203,685,477.5808 to 922,337,203,685,477.5807
sql_variant stores upto 8,000 characters

You might also like