SlideShare a Scribd company logo
Introduction to SQL Server
 Working with MS SQL Server and SQL Server Management Studio
Table of Contents
1. SQL Server Overview
2. SQL Server Services
3. Types of Databases
4. Authentication and Permissions
5. SQL Server Management Studio
6. Moving a SQL Server Database
 Through Backups and Restore
 By Detaching and Attaching
2
What is Microsoft SQL Server?
 MS SQL Server
Relational Database Management System
(RDBMS) from Microsoft
The main language in SQL Server
 Transact SQL (T-SQL), an extension of SQL
 Powerful, trustworthy, easy-to-use DB server
 The most recent version is SQL Server 2022
 Works only on Windows systems
4
How to Install SQL Server?
1. Download SQL Server 2014
 SQL Server 2014 Express (free distribution)
 http://www.microsoft.com/express/database/
 DreamSpark – you can register with academic email
5
SQL Server Services
Background-Running Processes
Services of SQL Server
 SQL Server – the database engine
 Responsible for database management, data storage, queries, data manipulation,
data integrity, transactions, locking, users, security, etc.
 Executes SQL / T-SQL queries
 SQL Server Agent – DB monitoring
 Executes scheduled tasks
 Monitors the SQL Server
 Sends notifications about problems
7
SQL Server Databases
msdb
Northwind
tempdb
msdb
SQL Server Databases
 SQL Server has system and user databases
 System databases
 Maintain internal information about MS SQL Server as a system
 Don't play with them!
 User databases
 Databases created by users (developers)
 Store user's schemas and data
 Use the system databases internally
10
Types of SQL Server Databases
11
System Databases
User Databases
model tempdb msdb distribution
pubs Northwind …
master
System Databases
 Master – meta-database keeping data about
 User accounts
 Configurable environment variables
 System error messages
 Model – a prototype for new databases
 Tempdb – storage for temporary tables and database objects
 MSdb – alerts and scheduled tasks
12
SQL Server Databases
 Each SQL Server database consists of two files:
 .mdf file
 Contains the core data in the database
 Schema, tables data, and other database objects
 .ldf file
 Transaction log – keeps track of transactions
 You need both these files to use the database
13
SQL Server Authentication
Users, Roles, Permissions
Connecting to SQL Server
 Connecting to SQL Server requires
 The name of the server (e.g. localhost)
 The name of the DB instance (e.g. SQLEXPRESS)
 The name of the database (e.g. Northwind)
 Username / password (if using SQL Server authentication)
 Types of authentication in SQL Server
 Windows (by using a Windows user credentials)
 Mixed (both Windows and SQL Server)
15
SQL Server Users Permissions
 Each user has certain permissions and roles for a database (Database User
Account)
 A role defines a group of users with the same permissions
 There are 3 types of roles in MS SQL Server
 Fixed server roles
 Fixed database roles
 User-defined database roles
16
Fixed Database Roles
 Public – maintains all default permissions for users in
a database
 Db_owner – performs any database role activity
 Db_accessadmin – add or remove database users,
groups, and roles
 Db_ddladmin – add, modify, or drop database objects
 Db_securityadmin – assign statement and object
permissions
 Others …
17
SQL Server
Authentication
Live Demo
SQL Server Management Studio
A Powerful Management Tool for Administrators and Developers
SQL Server Management Studio (SSMS)
 SQL Server Management Studio (SSMS) is a powerful graphical DB management
tool
 Administrate databases (create, modify, backup / restore DB)
 Create and modify E/R diagrams
 View / modify table data and other DB objects
 Execute SQL queries
 Free and easy to use tool
 Works with all SQL Server versions
20
SQL Server Management Studio –
Screenshot
21
SSMS Setting Server Account
 You can use SSMS to create database user / give permissions to Windows users
 Follow these steps:
1. Right click on the [Security / Login] folder in Object Explorer and choose "New
Login…"
22
SSMS Setting Server Account (2)
2. In the next dialog click the [Search] button
 Select one of the Windows accounts in a typical Windows
fashion
 Leave the authentication method set to Windows
authentication
 Click [OK]
 Thus you create an SQL Server User account
 Account permissions could be assigned later
 Windows administrators already have access
23
SSMS Setting Database Account
1. Right click on the "Security" under some of the databases and choose "New"
 "User"
2. Enter username and select one of the Server accounts to use
3. Assign the roles for this user
4. Click [OK] to confirm
 By selecting the [Name-of-Database]  "Properties"  "Permissions" you can also
set specific permissions for the accounts
24
Creating Accounts and
Assigning Permissions in SQL
Server
Using SQL Server Management Studio
 SSMS can be used to visually edit the structure or data in a database
 It can execute T-SQL queries
 Select the database you want to work with in the Object Explorer
 Click the [New Query] button
 Write the query in the window to the right of Object Explorer
 Click the [Execute] button
26
Executing SQL – Screenshot
27
Executing Simple SQL
Queries in SQL Server
Management Studio
Moving an SQL Server Database
Backup / Restore, Detach / Attach
Moving a SQL Server Database
 Necessary when we install a certain application at the customer environment
 Ways of moving an SQL Server database:
 By backup and restore
 Create backup and restore it on the other server
 By detaching and attaching the database files
 The 2 servers must be the same versions!
 By dumping the database as SQL script
 Export the database to SQL script and import it into a new server
30
Moving DB by Backup and Restore
 Backup and restore database through SSMS
31
Moving DB by Detaching and Attaching
 On the source server:
 Choose the database in SQL Server Management Studio
 From the context menu we choose the Detach command
 We copy the database files from the source server to the destination server:
 <database_name>.mdf
 <database_name>.ldf
 Typical location: C:Program FilesMicrosoft SQL
ServerMSSQL12.MSSQLSERVERMSSQLDATA
32
Moving DB by SQL Script Export / Import
 Export a MS SQL database as SQL script
Database  Tasks  Generate Scripts
Advanced  Types of data to script 
Schema and data
33
Moving a Database by
Detaching and Attaching
SQL Server LocalDB
Auto-Started MSQL Databases
SQL Server LocalDB
 SQL Server Express LocalDB
 Special version of SQL Server Express for developers
 Lightweight, dynamically attachable MSSQL databases
 Auto-started upon connection request
 Console-based administration
 List all LocalDB engine instances:
 Start a LocalDB engine instance:
 Stop a LocalDB engine instance:
36
sqllocaldb info
sqllocaldb start MSSQLLocalDB
sqllocaldb stop MSSQLLocalDB
Connecting to SQL Server LocalDB
 SQL Server LocalDB uses special connection strings:
 SQL Server Express 2012 LocalDB:
 SQL Server Express 2014 LocalDB:
 The database engine is
auto-started on demand
(upon connection request)
37
(localdb)v11.0
(localdb)MSSQLLocalDB
SQL Server LocalDB
Summary
 What is RDBMS?
 What is the purpose of
SQL Server Agent service?
 What is MSdb?
 Why we need the .ldf file?
 How do we backup / restore a database?
 How do we export a DB to SQL script?
 How do we import a DB from a SQL script?
 What is SQL Server Express LocalDB?
39

More Related Content

What's hot

Sql server logshipping
Sql server logshippingSql server logshipping
Sql server logshipping
Zeba Ansari
 
Azure data factory
Azure data factoryAzure data factory
Azure data factory
BizTalk360
 
Azure Data Factory Data Flow
Azure Data Factory Data FlowAzure Data Factory Data Flow
Azure Data Factory Data Flow
Mark Kromer
 
Sql server 2016 always on 可用性グループ new features
Sql server 2016 always on 可用性グループ new featuresSql server 2016 always on 可用性グループ new features
Sql server 2016 always on 可用性グループ new features
Masayuki Ozawa
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
James Serra
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
Gianluca Hotz
 
Active dataguard
Active dataguardActive dataguard
Active dataguard
Manoj Kumar
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
Ajeet Singh
 
SQL server part 1
SQL server  part 1SQL server  part 1
SQL server part 1
Birhanu Dagnew Sendek
 
Tableau Server Basics
Tableau Server BasicsTableau Server Basics
Tableau Server Basics
Nithyamoorthy Sadaiyan
 
Azure data bricks by Eugene Polonichko
Azure data bricks by Eugene PolonichkoAzure data bricks by Eugene Polonichko
Azure data bricks by Eugene Polonichko
Alex Tumanoff
 
MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and Engine
Abdul Manaf
 
MS Sql Server: Feeding Data Into Database
MS Sql Server: Feeding Data Into DatabaseMS Sql Server: Feeding Data Into Database
MS Sql Server: Feeding Data Into Database
DataminingTools Inc
 
Tableau Architecture
Tableau ArchitectureTableau Architecture
Tableau Architecture
Vivek Mohan
 
Azure Data Factory
Azure Data FactoryAzure Data Factory
Azure Data Factory
HARIHARAN R
 
Azure Data Factory Data Flows Training v005
Azure Data Factory Data Flows Training v005Azure Data Factory Data Flows Training v005
Azure Data Factory Data Flows Training v005
Mark Kromer
 
SQL Server Integration Services
SQL Server Integration ServicesSQL Server Integration Services
SQL Server Integration Services
Robert MacLean
 
Auditing Data Access in SQL Server
Auditing Data Access in SQL ServerAuditing Data Access in SQL Server
Auditing Data Access in SQL Server
Antonios Chatzipavlis
 
SQL Server 入門
SQL Server 入門SQL Server 入門
SQL Server 入門
Tsuyoshi Kitagawa
 
Azure SQL Database
Azure SQL DatabaseAzure SQL Database
Azure SQL Database
rockplace
 

What's hot (20)

Sql server logshipping
Sql server logshippingSql server logshipping
Sql server logshipping
 
Azure data factory
Azure data factoryAzure data factory
Azure data factory
 
Azure Data Factory Data Flow
Azure Data Factory Data FlowAzure Data Factory Data Flow
Azure Data Factory Data Flow
 
Sql server 2016 always on 可用性グループ new features
Sql server 2016 always on 可用性グループ new featuresSql server 2016 always on 可用性グループ new features
Sql server 2016 always on 可用性グループ new features
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
 
Always on in sql server 2017
Always on in sql server 2017Always on in sql server 2017
Always on in sql server 2017
 
Active dataguard
Active dataguardActive dataguard
Active dataguard
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
 
SQL server part 1
SQL server  part 1SQL server  part 1
SQL server part 1
 
Tableau Server Basics
Tableau Server BasicsTableau Server Basics
Tableau Server Basics
 
Azure data bricks by Eugene Polonichko
Azure data bricks by Eugene PolonichkoAzure data bricks by Eugene Polonichko
Azure data bricks by Eugene Polonichko
 
MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and Engine
 
MS Sql Server: Feeding Data Into Database
MS Sql Server: Feeding Data Into DatabaseMS Sql Server: Feeding Data Into Database
MS Sql Server: Feeding Data Into Database
 
Tableau Architecture
Tableau ArchitectureTableau Architecture
Tableau Architecture
 
Azure Data Factory
Azure Data FactoryAzure Data Factory
Azure Data Factory
 
Azure Data Factory Data Flows Training v005
Azure Data Factory Data Flows Training v005Azure Data Factory Data Flows Training v005
Azure Data Factory Data Flows Training v005
 
SQL Server Integration Services
SQL Server Integration ServicesSQL Server Integration Services
SQL Server Integration Services
 
Auditing Data Access in SQL Server
Auditing Data Access in SQL ServerAuditing Data Access in SQL Server
Auditing Data Access in SQL Server
 
SQL Server 入門
SQL Server 入門SQL Server 入門
SQL Server 入門
 
Azure SQL Database
Azure SQL DatabaseAzure SQL Database
Azure SQL Database
 

Similar to 2. Introduction-to-MSSQL-Server.pptx

Sql Sever Presentation.pptx
Sql Sever Presentation.pptxSql Sever Presentation.pptx
Sql Sever Presentation.pptx
zeeshanahmed213830
 
Trainmesfottech - Sql Server DBA Training Course Content
Trainmesfottech - Sql Server DBA Training Course ContentTrainmesfottech - Sql Server DBA Training Course Content
Trainmesfottech - Sql Server DBA Training Course Content
Trainmesofttech
 
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
SpanishPASSVC
 
Mssql database repair when DBCC CHECKDB fails
Mssql database repair when DBCC CHECKDB failsMssql database repair when DBCC CHECKDB fails
Mssql database repair when DBCC CHECKDB fails
mssqldatabase repair
 
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginnersSQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
Tobias Koprowski
 
Sql server configuration manager
Sql server configuration managerSql server configuration manager
Sql server configuration manager
ssuser1eca7d
 
Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101
IDERA Software
 
My sql basic
My sql basicMy sql basic
My sql basic
Prabhat gangwar
 
Sql server lesson2
Sql server lesson2Sql server lesson2
Sql server lesson2
Ala Qunaibi
 
SQL Server Intro
SQL Server IntroSQL Server Intro
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
webhostingguy
 
SULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpressSULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpress
SULTHAN BASHA
 
Project Presentation
Project PresentationProject Presentation
Project Presentation
ShariffAyesha
 
Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NET
Fernando G. Guerrero
 
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloudKoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
Tobias Koprowski
 
SafePeak - How to configure SQL Server agent in a safepeak deployment
SafePeak - How to configure SQL Server agent in a safepeak deploymentSafePeak - How to configure SQL Server agent in a safepeak deployment
SafePeak - How to configure SQL Server agent in a safepeak deployment
Vladi Vexler
 

Similar to 2. Introduction-to-MSSQL-Server.pptx (20)

Sql Sever Presentation.pptx
Sql Sever Presentation.pptxSql Sever Presentation.pptx
Sql Sever Presentation.pptx
 
Trainmesfottech - Sql Server DBA Training Course Content
Trainmesfottech - Sql Server DBA Training Course ContentTrainmesfottech - Sql Server DBA Training Course Content
Trainmesfottech - Sql Server DBA Training Course Content
 
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
24 HOP edición Español -Diferentes técnicas de administración de logins y usu...
 
Mssql database repair when DBCC CHECKDB fails
Mssql database repair when DBCC CHECKDB failsMssql database repair when DBCC CHECKDB fails
Mssql database repair when DBCC CHECKDB fails
 
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginnersSQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
 
Sql server configuration manager
Sql server configuration managerSql server configuration manager
Sql server configuration manager
 
Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101Geek Sync | SQL Security Principals and Permissions 101
Geek Sync | SQL Security Principals and Permissions 101
 
My sql basic
My sql basicMy sql basic
My sql basic
 
Sql server lesson2
Sql server lesson2Sql server lesson2
Sql server lesson2
 
SQL Server Intro
SQL Server IntroSQL Server Intro
SQL Server Intro
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
Introduction to MySQL - Part 1
Introduction to MySQL - Part 1Introduction to MySQL - Part 1
Introduction to MySQL - Part 1
 
SULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpressSULTHAN's PHP, MySQL & wordpress
SULTHAN's PHP, MySQL & wordpress
 
Project Presentation
Project PresentationProject Presentation
Project Presentation
 
Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NET
 
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloudKoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
KoprowskiT_SQLSat230_Rheinland_SQLAzure-fromPlantoBackuptoCloud
 
SafePeak - How to configure SQL Server agent in a safepeak deployment
SafePeak - How to configure SQL Server agent in a safepeak deploymentSafePeak - How to configure SQL Server agent in a safepeak deployment
SafePeak - How to configure SQL Server agent in a safepeak deployment
 

Recently uploaded

一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
agdhot
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
nyvan3
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
ytypuem
 
reading_sample_sap_press_operational_data_provisioning_with_sap_bw4hana (1).pdf
reading_sample_sap_press_operational_data_provisioning_with_sap_bw4hana (1).pdfreading_sample_sap_press_operational_data_provisioning_with_sap_bw4hana (1).pdf
reading_sample_sap_press_operational_data_provisioning_with_sap_bw4hana (1).pdf
perranet1
 
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
PsychoTech Services
 
06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases
06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases
06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases
Timothy Spann
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
Vietnam Cotton & Spinning Association
 
Data Scientist Machine Learning Profiles .pdf
Data Scientist Machine Learning  Profiles .pdfData Scientist Machine Learning  Profiles .pdf
Data Scientist Machine Learning Profiles .pdf
Vineet
 
Q4FY24 Investor-Presentation.pdf bank slide
Q4FY24 Investor-Presentation.pdf bank slideQ4FY24 Investor-Presentation.pdf bank slide
Q4FY24 Investor-Presentation.pdf bank slide
mukulupadhayay1
 
一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理
ugydym
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
bmucuha
 
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
ywqeos
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
aguty
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
Vietnam Cotton & Spinning Association
 
CAP Excel Formulas & Functions July - Copy (4).pdf
CAP Excel Formulas & Functions July - Copy (4).pdfCAP Excel Formulas & Functions July - Copy (4).pdf
CAP Excel Formulas & Functions July - Copy (4).pdf
frp60658
 
一比一原版(heriotwatt学位证书)英国赫瑞瓦特大学毕业证如何办理
一比一原版(heriotwatt学位证书)英国赫瑞瓦特大学毕业证如何办理一比一原版(heriotwatt学位证书)英国赫瑞瓦特大学毕业证如何办理
一比一原版(heriotwatt学位证书)英国赫瑞瓦特大学毕业证如何办理
zoykygu
 
06-18-2024-Princeton Meetup-Introduction to Milvus
06-18-2024-Princeton Meetup-Introduction to Milvus06-18-2024-Princeton Meetup-Introduction to Milvus
06-18-2024-Princeton Meetup-Introduction to Milvus
Timothy Spann
 
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
Rebecca Bilbro
 
saps4hanaandsapanalyticswheretodowhat1565272000538.pdf
saps4hanaandsapanalyticswheretodowhat1565272000538.pdfsaps4hanaandsapanalyticswheretodowhat1565272000538.pdf
saps4hanaandsapanalyticswheretodowhat1565272000538.pdf
newdirectionconsulta
 
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Marlon Dumas
 

Recently uploaded (20)

一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
 
reading_sample_sap_press_operational_data_provisioning_with_sap_bw4hana (1).pdf
reading_sample_sap_press_operational_data_provisioning_with_sap_bw4hana (1).pdfreading_sample_sap_press_operational_data_provisioning_with_sap_bw4hana (1).pdf
reading_sample_sap_press_operational_data_provisioning_with_sap_bw4hana (1).pdf
 
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
Interview Methods - Marital and Family Therapy and Counselling - Psychology S...
 
06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases
06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases
06-20-2024-AI Camp Meetup-Unstructured Data and Vector Databases
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
 
Data Scientist Machine Learning Profiles .pdf
Data Scientist Machine Learning  Profiles .pdfData Scientist Machine Learning  Profiles .pdf
Data Scientist Machine Learning Profiles .pdf
 
Q4FY24 Investor-Presentation.pdf bank slide
Q4FY24 Investor-Presentation.pdf bank slideQ4FY24 Investor-Presentation.pdf bank slide
Q4FY24 Investor-Presentation.pdf bank slide
 
一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
 
CAP Excel Formulas & Functions July - Copy (4).pdf
CAP Excel Formulas & Functions July - Copy (4).pdfCAP Excel Formulas & Functions July - Copy (4).pdf
CAP Excel Formulas & Functions July - Copy (4).pdf
 
一比一原版(heriotwatt学位证书)英国赫瑞瓦特大学毕业证如何办理
一比一原版(heriotwatt学位证书)英国赫瑞瓦特大学毕业证如何办理一比一原版(heriotwatt学位证书)英国赫瑞瓦特大学毕业证如何办理
一比一原版(heriotwatt学位证书)英国赫瑞瓦特大学毕业证如何办理
 
06-18-2024-Princeton Meetup-Introduction to Milvus
06-18-2024-Princeton Meetup-Introduction to Milvus06-18-2024-Princeton Meetup-Introduction to Milvus
06-18-2024-Princeton Meetup-Introduction to Milvus
 
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
 
saps4hanaandsapanalyticswheretodowhat1565272000538.pdf
saps4hanaandsapanalyticswheretodowhat1565272000538.pdfsaps4hanaandsapanalyticswheretodowhat1565272000538.pdf
saps4hanaandsapanalyticswheretodowhat1565272000538.pdf
 
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
Discovering Digital Process Twins for What-if Analysis: a Process Mining Appr...
 

2. Introduction-to-MSSQL-Server.pptx

  • 1. Introduction to SQL Server  Working with MS SQL Server and SQL Server Management Studio
  • 2. Table of Contents 1. SQL Server Overview 2. SQL Server Services 3. Types of Databases 4. Authentication and Permissions 5. SQL Server Management Studio 6. Moving a SQL Server Database  Through Backups and Restore  By Detaching and Attaching 2
  • 3. What is Microsoft SQL Server?  MS SQL Server Relational Database Management System (RDBMS) from Microsoft The main language in SQL Server  Transact SQL (T-SQL), an extension of SQL  Powerful, trustworthy, easy-to-use DB server  The most recent version is SQL Server 2022  Works only on Windows systems 4
  • 4. How to Install SQL Server? 1. Download SQL Server 2014  SQL Server 2014 Express (free distribution)  http://www.microsoft.com/express/database/  DreamSpark – you can register with academic email 5
  • 6. Services of SQL Server  SQL Server – the database engine  Responsible for database management, data storage, queries, data manipulation, data integrity, transactions, locking, users, security, etc.  Executes SQL / T-SQL queries  SQL Server Agent – DB monitoring  Executes scheduled tasks  Monitors the SQL Server  Sends notifications about problems 7
  • 8. SQL Server Databases  SQL Server has system and user databases  System databases  Maintain internal information about MS SQL Server as a system  Don't play with them!  User databases  Databases created by users (developers)  Store user's schemas and data  Use the system databases internally 10
  • 9. Types of SQL Server Databases 11 System Databases User Databases model tempdb msdb distribution pubs Northwind … master
  • 10. System Databases  Master – meta-database keeping data about  User accounts  Configurable environment variables  System error messages  Model – a prototype for new databases  Tempdb – storage for temporary tables and database objects  MSdb – alerts and scheduled tasks 12
  • 11. SQL Server Databases  Each SQL Server database consists of two files:  .mdf file  Contains the core data in the database  Schema, tables data, and other database objects  .ldf file  Transaction log – keeps track of transactions  You need both these files to use the database 13
  • 12. SQL Server Authentication Users, Roles, Permissions
  • 13. Connecting to SQL Server  Connecting to SQL Server requires  The name of the server (e.g. localhost)  The name of the DB instance (e.g. SQLEXPRESS)  The name of the database (e.g. Northwind)  Username / password (if using SQL Server authentication)  Types of authentication in SQL Server  Windows (by using a Windows user credentials)  Mixed (both Windows and SQL Server) 15
  • 14. SQL Server Users Permissions  Each user has certain permissions and roles for a database (Database User Account)  A role defines a group of users with the same permissions  There are 3 types of roles in MS SQL Server  Fixed server roles  Fixed database roles  User-defined database roles 16
  • 15. Fixed Database Roles  Public – maintains all default permissions for users in a database  Db_owner – performs any database role activity  Db_accessadmin – add or remove database users, groups, and roles  Db_ddladmin – add, modify, or drop database objects  Db_securityadmin – assign statement and object permissions  Others … 17
  • 17. SQL Server Management Studio A Powerful Management Tool for Administrators and Developers
  • 18. SQL Server Management Studio (SSMS)  SQL Server Management Studio (SSMS) is a powerful graphical DB management tool  Administrate databases (create, modify, backup / restore DB)  Create and modify E/R diagrams  View / modify table data and other DB objects  Execute SQL queries  Free and easy to use tool  Works with all SQL Server versions 20
  • 19. SQL Server Management Studio – Screenshot 21
  • 20. SSMS Setting Server Account  You can use SSMS to create database user / give permissions to Windows users  Follow these steps: 1. Right click on the [Security / Login] folder in Object Explorer and choose "New Login…" 22
  • 21. SSMS Setting Server Account (2) 2. In the next dialog click the [Search] button  Select one of the Windows accounts in a typical Windows fashion  Leave the authentication method set to Windows authentication  Click [OK]  Thus you create an SQL Server User account  Account permissions could be assigned later  Windows administrators already have access 23
  • 22. SSMS Setting Database Account 1. Right click on the "Security" under some of the databases and choose "New"  "User" 2. Enter username and select one of the Server accounts to use 3. Assign the roles for this user 4. Click [OK] to confirm  By selecting the [Name-of-Database]  "Properties"  "Permissions" you can also set specific permissions for the accounts 24
  • 23. Creating Accounts and Assigning Permissions in SQL Server
  • 24. Using SQL Server Management Studio  SSMS can be used to visually edit the structure or data in a database  It can execute T-SQL queries  Select the database you want to work with in the Object Explorer  Click the [New Query] button  Write the query in the window to the right of Object Explorer  Click the [Execute] button 26
  • 25. Executing SQL – Screenshot 27
  • 26. Executing Simple SQL Queries in SQL Server Management Studio
  • 27. Moving an SQL Server Database Backup / Restore, Detach / Attach
  • 28. Moving a SQL Server Database  Necessary when we install a certain application at the customer environment  Ways of moving an SQL Server database:  By backup and restore  Create backup and restore it on the other server  By detaching and attaching the database files  The 2 servers must be the same versions!  By dumping the database as SQL script  Export the database to SQL script and import it into a new server 30
  • 29. Moving DB by Backup and Restore  Backup and restore database through SSMS 31
  • 30. Moving DB by Detaching and Attaching  On the source server:  Choose the database in SQL Server Management Studio  From the context menu we choose the Detach command  We copy the database files from the source server to the destination server:  <database_name>.mdf  <database_name>.ldf  Typical location: C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLDATA 32
  • 31. Moving DB by SQL Script Export / Import  Export a MS SQL database as SQL script Database  Tasks  Generate Scripts Advanced  Types of data to script  Schema and data 33
  • 32. Moving a Database by Detaching and Attaching
  • 34. SQL Server LocalDB  SQL Server Express LocalDB  Special version of SQL Server Express for developers  Lightweight, dynamically attachable MSSQL databases  Auto-started upon connection request  Console-based administration  List all LocalDB engine instances:  Start a LocalDB engine instance:  Stop a LocalDB engine instance: 36 sqllocaldb info sqllocaldb start MSSQLLocalDB sqllocaldb stop MSSQLLocalDB
  • 35. Connecting to SQL Server LocalDB  SQL Server LocalDB uses special connection strings:  SQL Server Express 2012 LocalDB:  SQL Server Express 2014 LocalDB:  The database engine is auto-started on demand (upon connection request) 37 (localdb)v11.0 (localdb)MSSQLLocalDB
  • 37. Summary  What is RDBMS?  What is the purpose of SQL Server Agent service?  What is MSdb?  Why we need the .ldf file?  How do we backup / restore a database?  How do we export a DB to SQL script?  How do we import a DB from a SQL script?  What is SQL Server Express LocalDB? 39