SlideShare a Scribd company logo
WELCOME
Introduction To DBMS and
SQL SERVER
DDL,DML,DCL
What is Database?
• A collection of information organized in such a way that
a computer program can quickly select desired pieces of data.
• You can think of a database as an electronic filing system
Where do we use Database?
Front End: done in PHP / .Net / JSP or
any server side scripting languages
Stores data at the Back end
database in MYSQL/SQL Server /
Oracle or any other DBMS
Database management system (DBMS)
“Simply DBMS helps you to create and manage databases-
same like MSWord helps you to create or manage word
documents.”
Database management system (DBMS)
– DBMS is a computer software providing the interface
between users and a database (or databases)
– It is a software system designed to allow the definition,
creation, querying, update, and administration of
databases
– Different types of DBMS are RDBMS, Object Oriented
DBMS, Network DBMS, Hierarchical DBMS
– Examples :Oracle, Mysql, PostgreSQl, SQL server, Firebird
etc
“ The RDBMS follows
Entity- Relationship model”
What is Entity – Relationship (ER) Data
Model ?
In ER model all the data will be viewed as Entities, Attributes and
different relations that can be defined between entities
• Entities
– Is an object in the real world that is distinguishable from
other objects
– Ex. Employees, Places
Attributes
– An entity is described in the database using a set of
attributes
– Ex. Employee_Name, Employee_Age, Gender
Entity – Relationship (ER) Data Model ?
Relationships
– A relationship is an association among two or more entities
• So a relation means simply a two dimensional table
• Entities will be data within a table
• And attributes will be the columns of that table
Relational model basics
• Data is viewed as existing in two dimensional tables known as
relations.
• A relation (table) consists of unique attributes (columns) and
tuples (rows)
Emp_id Emp_name Emp_age Emp_email
1000 Deepak 24 dk@gmail.com
1001 Aneesh 23 an@gmail.com
1002 Naveen 25 nn@gmail.com
1003 Jacob 25 jb@gmail.com
Attributes/Fields/Columns
Rows/
Records/
Tuples
Relational model Example
Pk_int_id Vchr_Designation
1 Area manager
2 Supervisor
3 Software Engineer
4 Clerk
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_placeTbl_designation
Emp_id Emp_name Emp_age Emp_email Fk_int_designation fk_int_place_id
1000 Deepak 24 dk@gmail.com 1 1
1001 Aneesh 23 an@gmail.com 2 1
1002 Naveen 25 nn@gmail.com 1 2
1003 Jacob 25 jb@gmail.com 3 4
Tbl_employee
Keys in relational Model
• Primary Key
• Here there are 2 employees with name “Deepak” but each
can be identified distinctly by defining a primary key
Keys in relational Model
• Primary Key
• The PRIMARY KEY constraint uniquely identifies each record in
a database table.
Relational model Example
Pk_int_id Vchr_Designation
1 Area manager
2 Supervisor
3 Software Engineer
4 Clerk
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_placeTbl_designation
Emp_id Emp_name Emp_age Emp_email Fk_int_designatio
n
fk_int_place_id
1000 Deepak 24 dk@gmail.com 1 1
1001 Aneesh 23 an@gmail.com 2 1
1002 Naveen 25 nn@gmail.com 1 2
1003 Jacob 25 jb@gmail.com 3 4
Tbl_employee
Foreign Key
A Foreign key in one table points to a Primary Key of another table.
SQL SERVER
• Microsoft SQL (Structured Query Language) Server is a
relational database management system developed by
Microsoft.
• As a database server, it is a software product whose primary
function is to store and retrieve data as requested by other
software applications, be it those on the same computer or
those running on another computer across a network
(including the Internet). The SQL phrase stands for Structured
Query Language
• In January 2008, Sun Microsystems bought MySQL for $1
billion
SQL SEVER
• Data Definition Language (DDL)
• are used to define the database structure or schema.
– Create
– Alter
• Data Manipulation Language (DML)
• are used for managing data within schema objects.
– Insert
– Update
• Data Control Language (DCL) statements.
• Used to create roles, permissions, and referential integrity as well it is used to
control access to database by securing it.
– Grant
– Revoke
– Drop
– Truncate
– Delete
– SELECT
– Commit
– Rollback
DDL STATEMENTS
Create - Database
• To create a Database
– Syntax : CREATE DATABASE dbname;
– Example : CREATE DATABASE my_db;
• To Use a database
– Syntax : Use dbname;
– Example : Use my_db;
Creating a table
• Syntax
CREATE
TABLE table_name
(
column_name1
data_type(size),
column_name2
data_type(size),
column_name3
data_type(size),
PRIMARY
KEY(column_name1));
• Example
CREATE TABLE Persons
(
PersonID int
identity(1,1),
FirstName varchar(255),
Address varchar(255),
City varchar(255),
Primary key(PersonalID)
);
DDL - Altering a table
• ALTER TABLE Persons ADD email VARCHAR(60);
• ALTER TABLE Persons DROP COLUMN city;
• ALTER TABLE Persons CHANGE FirstName FullName
VARCHAR(20);
DDL - Deleting a Table
• DROP TABLE table_name ;
DML STATEMENTS
DML - Insert Data into a table
• Syntax :
– INSERT INTO table_name VALUES
(value1,value2,value3,...);
• Example:
– INSERT INTO Customers (CustomerName, City, Country)
VALUES (baabtra', ‘Calicut', ‘India');
• Note : String and date values are specified as quoted string.
Also with insert you can insert NULL directly to represent a
missing value.
DML -Retrieving information from a table
The SELECT statement is used to pull data from a table”
Syntax:
– SELECT what_to_select FROM table_name Where
conditions_to_satisfy ;
What_to_select indicates
what you want to see. This
can be a list of columns or *
to indicate “all columns”.
The Where clause is
optional. If it is present,
conditions_to_satisfy
specifies one or more
conditions that rows must
satisfy to qualify for
retrieval.
DML - Example
• Select * from person;
• Select id,firstname from person;
• Select * from person where city=‘banglore’
DML - Update Query
• Syntax:
•UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
• Example:
•UPDATE Customers
SET ContactName=‘Alex', City=‘calicut'
WHERE CustomerName=‘baabtra';
Delete Query
• Syntax:
– DELETE FROM table_name
WHERE some_column=some_value;
• Example :
– DELETE FROM Customers
WHERE CustomerName=‘baabtra' AND
ContactName='Maria';
DCL STATEMENTS
DCL – Setting Privilege
• Example:
GRANT ALL ON baabtra.user TO ‘someuser'@'somehost';
What previlages to be given
All -> will set all the
privileges
SELECT-> will set only to
select privilage
table name Username
REVOKE ALL ON baabtra.user FROM 'jeffrey'@'localhost';
Questions?
“A good question deserve a good grade…”
Self Check !!
• Attribute of an entity is represented as
– Row
– Column
– table
Self Check !!
• Attribute of an entity is represented as
– Row
– Column
– table
Self Check !!
• In ER model each entity is represented
within
– Relations/tables
– Attributes
– Schemas
– Objects
Self Check !!
• In ER model each entity is represented
within
– Relations/tables
– Attributes
– Schemas
– Objects
Self Check !!
• DDL is used to
– Define/Manipulate the data
– Define/Manipulate the structure of data
– Define/Manipulate the access privilege
Self Check !!
• DDL is used to
– Define/Manipulate the data
– Define/Manipulate the structure of data
– Define/Manipulate the access privilege
Self Check !!
• Example for DML is
– Deleting all table data
– Creating a column
– Changing column data type
Self Check !!
• Example for DML is
– Deleting all table data
– Creating a column
– Changing column data type
Self Check !!
• Write a query to create below table
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_place
• create table tbl_place
(
pk_int_id int primary key auto_increment,
vchr_place varchar(20)
);
Self Check !!
• Write a query to create below table
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_place
• create table tbl_place
(
pk_int_id int primary key auto_increment,
vchr_place varchar(20)
);
Self Check !!
• Write a query to add one more column named “int_pin”
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_place
Ans: Alter table add column int_pin int;
Self Check !!
• Write a query to add one more column named “int_pin”
Pk_int_id Vchr_place
1 Mumbai
2 Kolkata
3 Bangalore
4 Cochin
Tbl_place
Ans: Alter table add column int_pin int;
End
THANK YOU..

More Related Content

What's hot

SQL
SQLSQL
Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)
Punjab University
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
NITISH KUMAR
 
Relational database
Relational database Relational database
Relational database
Megha Sharma
 
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
Dhananjay Goel
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
Nilt1234
 
SQL
SQLSQL
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
BG Java EE Course
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Languagepandey3045_bit
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
Rdbms
RdbmsRdbms
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
Douglas Bernardini
 
PostgreSQL
PostgreSQLPostgreSQL
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
VARSHAKUMARI49
 
SQL commands
SQL commandsSQL commands
SQL commands
GirdharRatne
 

What's hot (20)

Mysql
MysqlMysql
Mysql
 
SQL
SQLSQL
SQL
 
Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Relational database
Relational database Relational database
Relational database
 
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
 
SQL
SQLSQL
SQL
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Language
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
Sql commands
Sql commandsSql commands
Sql commands
 
Rdbms
RdbmsRdbms
Rdbms
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
MS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTUREMS-SQL SERVER ARCHITECTURE
MS-SQL SERVER ARCHITECTURE
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
 
SQL commands
SQL commandsSQL commands
SQL commands
 
Sql ppt
Sql pptSql ppt
Sql ppt
 

Similar to Chapter 1 introduction to sql server

SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
enosislearningcom
 
Adv DB - Full Handout.pdf
Adv DB - Full Handout.pdfAdv DB - Full Handout.pdf
Adv DB - Full Handout.pdf
3BRBoruMedia
 
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
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
Aditya Kumar Tripathy
 
Database system concepts
Database system conceptsDatabase system concepts
Database system conceptsKumar
 
intro for sql
intro for sql intro for sql
intro for sql
mahmoud mones
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptx
natesanp1234
 
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)
Rakibul Hasan Pranto
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Sachidananda M H
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
NilamHonmane
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 

Similar to Chapter 1 introduction to sql server (20)

Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Introduction to mysql part 1
Introduction to mysql part 1Introduction to mysql part 1
Introduction to mysql part 1
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
 
Module02
Module02Module02
Module02
 
Dbms Basics
Dbms BasicsDbms Basics
Dbms Basics
 
Adv DB - Full Handout.pdf
Adv DB - Full Handout.pdfAdv DB - Full Handout.pdf
Adv DB - Full Handout.pdf
 
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. .
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
Database system concepts
Database system conceptsDatabase system concepts
Database system concepts
 
intro for sql
intro for sql intro for sql
intro for sql
 
Database
DatabaseDatabase
Database
 
lovely
lovelylovely
lovely
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptx
 
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 

More from baabtra.com - No. 1 supplier of quality freshers

Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Php database connectivity
Php database connectivityPhp database connectivity
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Blue brain
Blue brainBlue brain
5g
5g5g
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Baabtra soft skills
Baabtra soft skillsBaabtra soft skills
Cell phone jammer
Cell phone jammerCell phone jammer

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 
Baabtra soft skills
Baabtra soft skillsBaabtra soft skills
Baabtra soft skills
 
Cell phone jammer
Cell phone jammerCell phone jammer
Cell phone jammer
 

Recently uploaded

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Chapter 1 introduction to sql server

  • 2. Introduction To DBMS and SQL SERVER DDL,DML,DCL
  • 3. What is Database? • A collection of information organized in such a way that a computer program can quickly select desired pieces of data. • You can think of a database as an electronic filing system
  • 4. Where do we use Database? Front End: done in PHP / .Net / JSP or any server side scripting languages Stores data at the Back end database in MYSQL/SQL Server / Oracle or any other DBMS
  • 5. Database management system (DBMS) “Simply DBMS helps you to create and manage databases- same like MSWord helps you to create or manage word documents.”
  • 6. Database management system (DBMS) – DBMS is a computer software providing the interface between users and a database (or databases) – It is a software system designed to allow the definition, creation, querying, update, and administration of databases – Different types of DBMS are RDBMS, Object Oriented DBMS, Network DBMS, Hierarchical DBMS – Examples :Oracle, Mysql, PostgreSQl, SQL server, Firebird etc
  • 7. “ The RDBMS follows Entity- Relationship model”
  • 8. What is Entity – Relationship (ER) Data Model ? In ER model all the data will be viewed as Entities, Attributes and different relations that can be defined between entities • Entities – Is an object in the real world that is distinguishable from other objects – Ex. Employees, Places Attributes – An entity is described in the database using a set of attributes – Ex. Employee_Name, Employee_Age, Gender
  • 9. Entity – Relationship (ER) Data Model ? Relationships – A relationship is an association among two or more entities • So a relation means simply a two dimensional table • Entities will be data within a table • And attributes will be the columns of that table
  • 10. Relational model basics • Data is viewed as existing in two dimensional tables known as relations. • A relation (table) consists of unique attributes (columns) and tuples (rows) Emp_id Emp_name Emp_age Emp_email 1000 Deepak 24 dk@gmail.com 1001 Aneesh 23 an@gmail.com 1002 Naveen 25 nn@gmail.com 1003 Jacob 25 jb@gmail.com Attributes/Fields/Columns Rows/ Records/ Tuples
  • 11. Relational model Example Pk_int_id Vchr_Designation 1 Area manager 2 Supervisor 3 Software Engineer 4 Clerk Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_placeTbl_designation Emp_id Emp_name Emp_age Emp_email Fk_int_designation fk_int_place_id 1000 Deepak 24 dk@gmail.com 1 1 1001 Aneesh 23 an@gmail.com 2 1 1002 Naveen 25 nn@gmail.com 1 2 1003 Jacob 25 jb@gmail.com 3 4 Tbl_employee
  • 12. Keys in relational Model • Primary Key • Here there are 2 employees with name “Deepak” but each can be identified distinctly by defining a primary key
  • 13. Keys in relational Model • Primary Key • The PRIMARY KEY constraint uniquely identifies each record in a database table.
  • 14. Relational model Example Pk_int_id Vchr_Designation 1 Area manager 2 Supervisor 3 Software Engineer 4 Clerk Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_placeTbl_designation Emp_id Emp_name Emp_age Emp_email Fk_int_designatio n fk_int_place_id 1000 Deepak 24 dk@gmail.com 1 1 1001 Aneesh 23 an@gmail.com 2 1 1002 Naveen 25 nn@gmail.com 1 2 1003 Jacob 25 jb@gmail.com 3 4 Tbl_employee Foreign Key A Foreign key in one table points to a Primary Key of another table.
  • 15. SQL SERVER • Microsoft SQL (Structured Query Language) Server is a relational database management system developed by Microsoft. • As a database server, it is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network (including the Internet). The SQL phrase stands for Structured Query Language • In January 2008, Sun Microsystems bought MySQL for $1 billion
  • 16. SQL SEVER • Data Definition Language (DDL) • are used to define the database structure or schema. – Create – Alter • Data Manipulation Language (DML) • are used for managing data within schema objects. – Insert – Update • Data Control Language (DCL) statements. • Used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it. – Grant – Revoke – Drop – Truncate – Delete – SELECT – Commit – Rollback
  • 18. Create - Database • To create a Database – Syntax : CREATE DATABASE dbname; – Example : CREATE DATABASE my_db; • To Use a database – Syntax : Use dbname; – Example : Use my_db;
  • 19. Creating a table • Syntax CREATE TABLE table_name ( column_name1 data_type(size), column_name2 data_type(size), column_name3 data_type(size), PRIMARY KEY(column_name1)); • Example CREATE TABLE Persons ( PersonID int identity(1,1), FirstName varchar(255), Address varchar(255), City varchar(255), Primary key(PersonalID) );
  • 20. DDL - Altering a table • ALTER TABLE Persons ADD email VARCHAR(60); • ALTER TABLE Persons DROP COLUMN city; • ALTER TABLE Persons CHANGE FirstName FullName VARCHAR(20); DDL - Deleting a Table • DROP TABLE table_name ;
  • 22. DML - Insert Data into a table • Syntax : – INSERT INTO table_name VALUES (value1,value2,value3,...); • Example: – INSERT INTO Customers (CustomerName, City, Country) VALUES (baabtra', ‘Calicut', ‘India'); • Note : String and date values are specified as quoted string. Also with insert you can insert NULL directly to represent a missing value.
  • 23. DML -Retrieving information from a table The SELECT statement is used to pull data from a table” Syntax: – SELECT what_to_select FROM table_name Where conditions_to_satisfy ; What_to_select indicates what you want to see. This can be a list of columns or * to indicate “all columns”. The Where clause is optional. If it is present, conditions_to_satisfy specifies one or more conditions that rows must satisfy to qualify for retrieval.
  • 24. DML - Example • Select * from person; • Select id,firstname from person; • Select * from person where city=‘banglore’
  • 25. DML - Update Query • Syntax: •UPDATE table_name SET column1=value1,column2=value2,... WHERE some_column=some_value; • Example: •UPDATE Customers SET ContactName=‘Alex', City=‘calicut' WHERE CustomerName=‘baabtra';
  • 26. Delete Query • Syntax: – DELETE FROM table_name WHERE some_column=some_value; • Example : – DELETE FROM Customers WHERE CustomerName=‘baabtra' AND ContactName='Maria';
  • 28. DCL – Setting Privilege • Example: GRANT ALL ON baabtra.user TO ‘someuser'@'somehost'; What previlages to be given All -> will set all the privileges SELECT-> will set only to select privilage table name Username REVOKE ALL ON baabtra.user FROM 'jeffrey'@'localhost';
  • 29. Questions? “A good question deserve a good grade…”
  • 30. Self Check !! • Attribute of an entity is represented as – Row – Column – table
  • 31. Self Check !! • Attribute of an entity is represented as – Row – Column – table
  • 32. Self Check !! • In ER model each entity is represented within – Relations/tables – Attributes – Schemas – Objects
  • 33. Self Check !! • In ER model each entity is represented within – Relations/tables – Attributes – Schemas – Objects
  • 34. Self Check !! • DDL is used to – Define/Manipulate the data – Define/Manipulate the structure of data – Define/Manipulate the access privilege
  • 35. Self Check !! • DDL is used to – Define/Manipulate the data – Define/Manipulate the structure of data – Define/Manipulate the access privilege
  • 36. Self Check !! • Example for DML is – Deleting all table data – Creating a column – Changing column data type
  • 37. Self Check !! • Example for DML is – Deleting all table data – Creating a column – Changing column data type
  • 38. Self Check !! • Write a query to create below table Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_place • create table tbl_place ( pk_int_id int primary key auto_increment, vchr_place varchar(20) );
  • 39. Self Check !! • Write a query to create below table Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_place • create table tbl_place ( pk_int_id int primary key auto_increment, vchr_place varchar(20) );
  • 40. Self Check !! • Write a query to add one more column named “int_pin” Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_place Ans: Alter table add column int_pin int;
  • 41. Self Check !! • Write a query to add one more column named “int_pin” Pk_int_id Vchr_place 1 Mumbai 2 Kolkata 3 Bangalore 4 Cochin Tbl_place Ans: Alter table add column int_pin int;
  • 42. End