SlideShare une entreprise Scribd logo
1  sur  42
Introduction to SQL Server 2005  Module 2
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Learning Objectives
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Module 2 : Agenda
Introduction to Database Engine ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],Introduction to SQL Server Database
Overview of Database Objects ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
System Database It is the key working area for your server tempdb is where the SQL Agent process stores any system tasks Msdb  This database forms a template for any new database that you create. model This database holds a special set of tables (system tables) that keeps track of the system as a whole master Description Database
User Database This is a companion sample database that can be installed with Microsoft SQL Server 2005. The database schema was designed to showcase SQL Server 2005 features. Adventure works  This database, like pubs, is a training database. Northwind This database provides a consistent place for training and experimentation pubs Description Database
Database Files ,[object Object],[object Object],[object Object],[object Object]
Structured Query Language ,[object Object],[object Object],[object Object],REVOKE GRANT DCL DELETE SAVEPOINT UPDATE DROP ROLLBACK INSERT ALTER COMMIT  SELECT CREATE TCL DML DDL
Data Definition Language (DDL) ,[object Object],[object Object],[object Object]
Data Manipulation Language (DML) ,[object Object],[object Object],[object Object]
Transaction Control Language(TCL) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Guidelines in writing SQL Statements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transact- SQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
To Create & Use Database ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Data Types Accepts an argument that determines size and precision Varies Approx. Numeric Float Monetary units from -214,748.3648 to +214,748.3647 4 Money SmallMoney Monetary units from -263 to 263 plus precision to 4 decimal places. 8 Money Money Fixed Precision and Scale from -10 38 -1 to 10 38 -1.  Varies Decimal/Numeric Decimal or Numeric 0 to 255 1 Integer TinyInt Whole Numbers (Small Range) 2 Integer SmallInt Whole Numbers 4 Integer Int Range is from -2 63  to 2 63 -1 8 Integer Bigint For storing binary values 1 Integer Bit Description Size in Bytes Class Data Type Name
Create Tables Syntax : ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Create Table - Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Delete Table ,[object Object],[object Object],[object Object],[object Object]
Data Integrity ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Type of Constraints ,[object Object],[object Object],[object Object],[object Object],[object Object]
Constraint – Not Null ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constraint – Check ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constraint – Check (Continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constraint – Unique ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constraint – Primary & Foreign Key  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constraint – Primary & Foreign Key  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rules ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Defaults ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Working with IDENTITY column ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
INSERT Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],table is the name of the table column is the name of the column in the table to populate value is the corresponding value for the column Note: This statement with the VALUES clause adds  only one row at a time to a table .
INSERT Statement (Continued) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Inserting Rows from Another Table ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UPDATE Statement ,[object Object],[object Object],[object Object],[object Object],table   is the name of the table column name of the column in the table to populate value corresponding   value   for   the   column condition identifies the rows to be updated and is composed of  column names, expressions, constraints, sub-queries,  and comparison operators
[object Object],[object Object],Updating Rows in a Table update dept  set deptno=10  where location= ‘ unknown ’
[object Object],Updating Rows Based on Another Table ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DELETE Statement ,[object Object],[object Object],table   is the name of the table condition identifies the rows to be deleted and is composed of  column names, expressions, constraints, sub-queries,  and comparison operators
[object Object],[object Object],Deleting Rows in a Table Delete from  dept where  deptno=10
[object Object],Deleting Rows Based on Another Table ,[object Object],[object Object],[object Object],[object Object]
Key Points ,[object Object],[object Object]
Questions & Comments

Contenu connexe

Tendances (20)

Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
12 SQL
12 SQL12 SQL
12 SQL
 
Database Architecture
Database ArchitectureDatabase Architecture
Database Architecture
 
Sql a practical introduction
Sql   a practical introductionSql   a practical introduction
Sql a practical introduction
 
Sql commands
Sql commandsSql commands
Sql commands
 
Intro to T-SQL - 1st session
Intro to T-SQL - 1st sessionIntro to T-SQL - 1st session
Intro to T-SQL - 1st session
 
Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)
 
SQL Differences SQL Interview Questions
SQL Differences  SQL Interview QuestionsSQL Differences  SQL Interview Questions
SQL Differences SQL Interview Questions
 
Using T-SQL
Using T-SQL Using T-SQL
Using T-SQL
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
 
Types of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligetiTypes of sql commands by naveen kumar veligeti
Types of sql commands by naveen kumar veligeti
 
Database Fundamental
Database FundamentalDatabase Fundamental
Database Fundamental
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Database queries
Database queriesDatabase queries
Database queries
 

En vedette

Multidimensional model programming
Multidimensional model programmingMultidimensional model programming
Multidimensional model programmingSteve Xu
 
Alasql - база данных SQL на JavaScript (MoscowJS)
Alasql - база данных SQL на JavaScript (MoscowJS)Alasql - база данных SQL на JavaScript (MoscowJS)
Alasql - база данных SQL на JavaScript (MoscowJS)Andrey Gershun
 
Multi-thematic spatial databases
Multi-thematic spatial databasesMulti-thematic spatial databases
Multi-thematic spatial databasesConor Mc Elhinney
 
Alasql.js - SQL сервер на JavaScript
Alasql.js - SQL сервер на JavaScriptAlasql.js - SQL сервер на JavaScript
Alasql.js - SQL сервер на JavaScriptAndrey Gershun
 
SQL Server 2008 for Developers
SQL Server 2008 for DevelopersSQL Server 2008 for Developers
SQL Server 2008 for Developersllangit
 
SQL Server 2008 for .NET Developers
SQL Server 2008 for .NET DevelopersSQL Server 2008 for .NET Developers
SQL Server 2008 for .NET Developersllangit
 
Css introduction
Css introductionCss introduction
Css introductionSridhar P
 
AlaSQL библиотека для обработки JavaScript данных (презентация для ForntEnd 2...
AlaSQL библиотека для обработки JavaScript данных (презентация для ForntEnd 2...AlaSQL библиотека для обработки JavaScript данных (презентация для ForntEnd 2...
AlaSQL библиотека для обработки JavaScript данных (презентация для ForntEnd 2...Andrey Gershun
 
Sql server ___________session3-normailzation
Sql server  ___________session3-normailzationSql server  ___________session3-normailzation
Sql server ___________session3-normailzationEhtisham Ali
 
5 tsssisu sql_server_2012
5 tsssisu sql_server_20125 tsssisu sql_server_2012
5 tsssisu sql_server_2012Steve Xu
 
High Performance Front-End Development
High Performance Front-End DevelopmentHigh Performance Front-End Development
High Performance Front-End Developmentdrywallbmb
 
Transact sql data definition language - ddl- reference
Transact sql data definition language - ddl- referenceTransact sql data definition language - ddl- reference
Transact sql data definition language - ddl- referenceSteve Xu
 

En vedette (20)

Multidimensional model programming
Multidimensional model programmingMultidimensional model programming
Multidimensional model programming
 
Alasql - база данных SQL на JavaScript (MoscowJS)
Alasql - база данных SQL на JavaScript (MoscowJS)Alasql - база данных SQL на JavaScript (MoscowJS)
Alasql - база данных SQL на JavaScript (MoscowJS)
 
SQL Server 2008 Spatial Data - Getting Started
SQL Server 2008 Spatial Data - Getting StartedSQL Server 2008 Spatial Data - Getting Started
SQL Server 2008 Spatial Data - Getting Started
 
Multi-thematic spatial databases
Multi-thematic spatial databasesMulti-thematic spatial databases
Multi-thematic spatial databases
 
Alasql.js - SQL сервер на JavaScript
Alasql.js - SQL сервер на JavaScriptAlasql.js - SQL сервер на JavaScript
Alasql.js - SQL сервер на JavaScript
 
SQL Server 2008 for Developers
SQL Server 2008 for DevelopersSQL Server 2008 for Developers
SQL Server 2008 for Developers
 
Module01
Module01Module01
Module01
 
Module08
Module08Module08
Module08
 
SQL Server 2008 for .NET Developers
SQL Server 2008 for .NET DevelopersSQL Server 2008 for .NET Developers
SQL Server 2008 for .NET Developers
 
Css introduction
Css introductionCss introduction
Css introduction
 
Module03
Module03Module03
Module03
 
AlaSQL библиотека для обработки JavaScript данных (презентация для ForntEnd 2...
AlaSQL библиотека для обработки JavaScript данных (презентация для ForntEnd 2...AlaSQL библиотека для обработки JavaScript данных (презентация для ForntEnd 2...
AlaSQL библиотека для обработки JavaScript данных (презентация для ForntEnd 2...
 
Sql server ___________session3-normailzation
Sql server  ___________session3-normailzationSql server  ___________session3-normailzation
Sql server ___________session3-normailzation
 
5 tsssisu sql_server_2012
5 tsssisu sql_server_20125 tsssisu sql_server_2012
5 tsssisu sql_server_2012
 
High Performance Front-End Development
High Performance Front-End DevelopmentHigh Performance Front-End Development
High Performance Front-End Development
 
Module05
Module05Module05
Module05
 
Transact sql data definition language - ddl- reference
Transact sql data definition language - ddl- referenceTransact sql data definition language - ddl- reference
Transact sql data definition language - ddl- reference
 
Module07
Module07Module07
Module07
 
Sql Server Data Tools - Codenamed JUNEAU
Sql Server Data Tools - Codenamed JUNEAUSql Server Data Tools - Codenamed JUNEAU
Sql Server Data Tools - Codenamed JUNEAU
 
Module06
Module06Module06
Module06
 

Similaire à Module02

Bank mangement system
Bank mangement systemBank mangement system
Bank mangement systemFaisalGhffar
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowPavithSingh
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptxSheethal Aji Mani
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .MayankSinghRawat6
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxEliasPetros
 
Azure Data Fundamentals DP 900 Full Course
Azure Data Fundamentals DP 900 Full CourseAzure Data Fundamentals DP 900 Full Course
Azure Data Fundamentals DP 900 Full CoursePiyush sachdeva
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredDanish Mehraj
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfDraguClaudiu
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developerAhsan Kabir
 
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresSteven Johnson
 

Similaire à Module02 (20)

Bank mangement system
Bank mangement systemBank mangement system
Bank mangement system
 
lovely
lovelylovely
lovely
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .
 
PO WER - Piotr Mariat - Sql
PO WER - Piotr Mariat - SqlPO WER - Piotr Mariat - Sql
PO WER - Piotr Mariat - Sql
 
intro for sql
intro for sql intro for sql
intro for sql
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Azure Data Fundamentals DP 900 Full Course
Azure Data Fundamentals DP 900 Full CourseAzure Data Fundamentals DP 900 Full Course
Azure Data Fundamentals DP 900 Full Course
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Adbms
AdbmsAdbms
Adbms
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
 
12 SQL
12 SQL12 SQL
12 SQL
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
 
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome Measures
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
 
Sql intro & ddl 1
Sql intro & ddl 1Sql intro & ddl 1
Sql intro & ddl 1
 

Dernier

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 

Dernier (20)

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 

Module02

  • 1. Introduction to SQL Server 2005 Module 2
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. System Database It is the key working area for your server tempdb is where the SQL Agent process stores any system tasks Msdb This database forms a template for any new database that you create. model This database holds a special set of tables (system tables) that keeps track of the system as a whole master Description Database
  • 8. User Database This is a companion sample database that can be installed with Microsoft SQL Server 2005. The database schema was designed to showcase SQL Server 2005 features. Adventure works This database, like pubs, is a training database. Northwind This database provides a consistent place for training and experimentation pubs Description Database
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Data Types Accepts an argument that determines size and precision Varies Approx. Numeric Float Monetary units from -214,748.3648 to +214,748.3647 4 Money SmallMoney Monetary units from -263 to 263 plus precision to 4 decimal places. 8 Money Money Fixed Precision and Scale from -10 38 -1 to 10 38 -1. Varies Decimal/Numeric Decimal or Numeric 0 to 255 1 Integer TinyInt Whole Numbers (Small Range) 2 Integer SmallInt Whole Numbers 4 Integer Int Range is from -2 63 to 2 63 -1 8 Integer Bigint For storing binary values 1 Integer Bit Description Size in Bytes Class Data Type Name
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.

Notes de l'éditeur

  1. Faculty Notes : Database Engine is the core service for storing, processing and securing data. It maintains the relationships between the stored data. It helps in the translation the data to information. It provides controlled access- While logging into SQL Server Management studio, we can select the server type as database engine. It facilitates rapid transaction processing to meet the requirements of the most demanding data consuming applications within the enterprise. The Database Engine provides rich support for sustaining high availability. In Microsoft SQL Server 2005, a Database Engine information worker is a domain expert who understands the relationships between the data stored in a database and is able to translate the data into business information. Information workers rarely interact directly with primary online transaction processing (OLTP) databases, instead they use the applications that are associated with the database. When information workers interact directly with databases it is typically to run ad-hoc queries or reports against secondary reporting databases, or to work with smaller databases that are distributed with workgroup or personal applications. A database in Microsoft SQL Server 2005 is made up of a collection of tables that contain data and other objects that are defined to support the activities performed with the data. These objects include views, indexes, stored procedures, and triggers. Before you can create objects within the database, you must create the database and also understand how to change the settings and the configuration of the database. This includes tasks such as expanding or shrinking the database, or specifying the files that are used to create the database.
  2. Database : The database holds all facts about all the entities. Database allows user for storing and maintaining the data. Transaction Log : Transactions logs are an important part of protecting your data .By keeping track of operations in a log, the database server makes it possible to recover from a wide range of disaster. The two types of Database in SQL Server are : System Databases : System Database are the database used to store the information about SQL Server itself and used for its operations. User Databases : Users Databases are the database created and maintained by the user.
  3. Faculty Notes : Tables - Tables are the objects in the database that actually store the data. Because all other objects in the database depend on their existence, tables can be considered the building blocks of the database. Views - View is an object of a database which contains the query. View when selected it executes the query and extracts the data from the base table. Indexes - Indexes improves the database performance. Indexes help to locate a row in a table directly in a data page instead of going through all the data pages. Stored Procedure - Stored Procedure is a name given to set of T-SQL statements. It includes control structures, looping add return values and so on. User Defined Functions - A function is a grouping of Transact SQL statements that can be reused. SQL server has a large number of built in functions, but these may not meet User needs. For this reason SQL Server gives an ability to create own function called user defined function to perform any task. Rules - Rules provide another means of enforcing domain and user defined integrity rules within user database. Defaults - Defaults are used to fill in the data in the columns if the user does not supply a value. User Defined Data Types - User Defined data Types are based on the system data types. They can be used when several tables must store the same type of data in a column and user must ensure that these columns have exactly the same data type, length, and null ability.
  4. pubs This database provides a consistent place for training and experimentation Northwind This database, like pubs, is a training database
  5. is where the SQL Agent process stores any system tasks
  6. Each database consists of at least two files: one is a primary data file (by default, with the .mdf extension), the other is a log file (by default, with the .ldf extension). There are also optional secondary data files (by default, with the .ndf extension). A database can have only one primary data file, zero or more secondary data files, and one or more log files. Each database file can be used by only one database. When SQL Server is functioning and operating, the database engine keeps track of almost every change that takes place within the database by making entries into the transaction log(.ldf) so that it can be used later if needed.
  7. Faculty Notes: Automicity: Automicity states that either all the data modifications are performed aor none of them are performed. Consistency : Consistency is a state in which all the data is in a consistent state after transaction is completed successfully All the rules in a relational database must be applied to the transaction modifications to maintain complete data integrity Isolation : If two transaction are in progress at once for example two users at different computers might be modifying the same table the transaction is isolated from the other. Durability : Durability states that any changes in data by a completed transaction remains permanently in effect in system Hence ,any change in data due to a completed transaction persists even in the event of a system failure This is ensured by the concept of backing up and restoring transaction logs.
  8. Faculty Notes: Review the points on this slide.
  9. Faculty Notes :
  10. Faculty Notes: Table is an object in the database. A table is collection of rows and columns associated with individual data item. For the above syntax : table_name - The name of the new table. Table names must comply with the rules for identifiers. The table_name must be unique within the database. A table_name can contain a maximum of 128 characters. column_name - The name of a column in the table. Column names must comply with the rules for identifiers and must be unique in the table. data_type - Specifies the column data type. DEFAULT- Specifies the value provided for the column when a value is not explicitly supplied during an insert action. DEFAULT definitions can be applied to any column, except those defined by the IDENTITY property. DEFAULT definitions are removed when the table is dropped. A constant value can be used as a default. IDENTITY - Indicates that the new column is an identity column. When a new row is added to the table, SQL Server Compact Edition provides a unique, incremental value for the column. Identity columns are generally used in conjunction with PRIMARY KEY constraints to serve as the unique row identifier for the table. The IDENTITY property can be assigned only to int columns. Only one identity column can be created per table. Bound defaults and DEFAULT constraints cannot be used with an identity column. You must specify both the seed and increment or neither. If neither is specified, the default is (1,1). seed - The value used for the first row that is loaded into the table. increment - The incremental value added to the identity value of the previous row that is loaded. ROWGUIDCOL - Indicates that the new column is a row global unique identifier column. Only one uniqueidentifier column per table can be designated as the ROWGUIDCOL column. The ROWGUIDCOL property can be assigned only to a uniqueidentifier column. ROWGUIDCOL automatically generates values for new rows inserted into the table. CONSTRAINT - An optional keyword indicating the beginning of a PRIMARY KEY , UNIQUE , or FOREIGN KEY constraint definition. Constraints are special properties that enforce data integrity and create special types of indexes for the table and its columns. constraint_name - The name of a constraint. The constraint_name is optional and must be unique within a database. If a constraint_name is not specified, SQL Server Compact Edition generates a constraint name. NULL | NOT NULL - Keywords that specify whether null values are permitted in the column. NULL is not strictly a constraint but can be specified in the same manner as NOT NULL . PRIMARY KEY - A constraint that enforces entity integrity for a particular column or columns using a unique index. Only one PRIMARY KEY constraint can be created per table. UNIQUE - A constraint that provides entity integrity for a particular column or columns using a unique index. Columns in a UNIQUE constraint can be NULL , but only one NULL value is allowed per column. A table can have multiple UNIQUE constraints. Note: SQL Server Compact Edition can use indexes to enforce PRIMARY KEY and UNIQUE constraints. We recommend that you do not rely on this behavior nor try to modify any indexes that are created as part of a constraint. FOREIGN KEY...REFERENCES -A constraint that provides referential integrity for the data in the column. FOREIGN KEY constraints require that each value in the column exists in the specified column in the referenced table. ref_table - The name of the table referenced by the FOREIGN KEY constraint. ( ref_column [ ,... n ] ) - A column, or list of columns, from the table referenced by the FOREIGN KEY constraint. ON DELETE {CASCADE | NO ACTION} , Specifies what action happens to a row in the table that is created when that row has a referential relationship and the referenced row is deleted from the parent table. The default is NO ACTION . If CASCADE is specified, a row is deleted from the referencing table when the corresponding referenced row is deleted from the parent table. If NO ACTION is specified, SQL Server Compact Edition returns an error and the delete action on the referenced row in the parent table is rolled back. ON UPDATE {CASCADE | NO ACTION} Specifies what action happens to a row in the table that is created when that row has a referential relationship, and the referenced row is updated in the parent table. The default is NO ACTION . If CASCADE is specified, the row is updated in the referencing table when the corresponding referenced row is updated in the parent table. If NO ACTION is specified, SQL Server Compact Edition returns an error and the update action on the referenced row in the parent table is rolled back. column - A column or list of columns, in parentheses, used in table constraints to indicate the columns used in the constraint definition.
  11. Faculty Notes : In the above example, Dbo – schema/owner of the database
  12. Faculty Notes : Insert the following records in the given order : insert into emp values (1,'sss',1,getdate(),1) insert into dept values (1,‘ LKM’ , ’MDC ') insert into emp values (1,'sss',1,getdate(),1)
  13. Faculty Notes : Like operator is using 8 characters. You can drop the rule with following command Drop rule sapid
  14. Faculty Notes : We are inserting partial date in the above query.
  15. Faculty Notes: The INSERT statement allows you to insert a single record or multiple records into a table.
  16. Faculty Notes: Note that the order of the values should correspond to the order of the columns.
  17. Faculty Notes: This is like a Bulk insert. Demo an INSERT statement in SQL Query Analyzer
  18. Faculty Notes: Define UPDATE The UPDATE statement is used to modify the data in a table. Is used to update one or more columns in a row
  19. Faculty Notes: The above update statement updates (changes) the Department Id of the employee whose Employee Id is 113 to Department Id 70
  20. Faculty Notes: The above Update command uses sub queries to update Department Id and Job Id of the employee The first subquery fetches Department Id value of employee whose Employee Id is 100 and assigns it to Department Id in the Select statement The Second subquery fetches Job Id value of employee whose Employee Id is 200 and assigns it to Job Id in the where clause of the Select statement Note: In sub queries always remember the select statement for the sub query should generate only one row of one column i.e. a single value
  21. Faculty Notes: Define DELETE The DELETE statement is used to delete rows in a table. Is used to delete one or more rows NOTE: Be cautious while using this statement as this may delete all records from a table accidentally, especially without the WHERE condition.
  22. Faculty Notes: The above Delete statement will delete employee whose employee Id is 113
  23. Faculty Notes: The above Delete statement is using a sub query to delete records from employee table It deletes employees of Dept Id whose value is generated from the sub query for the Department Type ‘CST’ Note: In sub queries always remember the select statement for the sub query should generate only one row of one column i.e. a single value
  24. Faculty Notes: Review the key points on the slide. The key points should be used to summarize the content covered throughout this presentation.