SlideShare a Scribd company logo
3
Most read
6
Most read
10
Most read
Microsoft SQL server
Lecture : four
Lecturer :Ashna nazm hamasalh
ashnanazm2@gmail.com
Kirkuk institute for computer science
1
lecturer.Miss.Ashna Nazm Hamasalh
outline
Microsoft SQL SERVER
SQL Parts
DDL STATEMENTS
2
lecturer.Miss.Ashna Nazm Hamasalh
DDL STATEMENTS
• To create a Database
– Syntax : CREATE DATABASE dbname;
– Example: CREATE DATABASE my_db;
• To Use a database
– Syntax : Use dbname;
– Example: Use my_db;
3
lecturer.Miss.Ashna Nazm Hamasalh
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)
);
4
lecturer.Miss.Ashna Nazm Hamasalh
DDL - Altering a table
• ALTER TABLE Persons ADD email VARCHAR(60);
• ALTER TABLE Persons DROP COLUMN city;
• exec sp_rename 'Table_1.email','fullname','column';
• DDL - Deleting a Table
• DROP TABLE table_name ;
5
lecturer.Miss.Ashna Nazm Hamasalh
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.
6
lecturer.Miss.Ashna Nazm Hamasalh
• 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 Whereconditions_to_satisfy ;
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.
What_to_select indicates
what you want to see.
This can be a list of
columns or * to indicate
“all columns”.
7
lecturer.Miss.Ashna Nazm Hamasalh
DML - Example
• Select * from person;
• Select id,firstname from person;
• Select * from person where city=‘banglore’
8
lecturer.Miss.Ashna Nazm Hamasalh
• 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';
9
lecturer.Miss.Ashna Nazm Hamasalh
• Delete Query
Syntax:
DELETE FROM table_name WHERE some_column=some_value;
Example :
DELETE FROM Customers WHERE CustomerName=‘baabtra' AND
ContactName='Maria';
10
lecturer.Miss.Ashna Nazm Hamasalh
11
lecturer.Miss.Ashna Nazm Hamasalh

More Related Content

PDF
Database Indexes
Sperasoft
 
PPTX
Physical architecture of sql server
Divya Sharma
 
PPT
Distributed Database Management System
Hardik Patil
 
PDF
MySQL Tutorial For Beginners | Relational Database Management System | MySQL ...
Edureka!
 
PDF
Relational database- Fundamentals
Mohammed El Hedhly
 
PPT
MySQL and its basic commands
Bwsrang Basumatary
 
PPTX
SQL Basics
Hammad Rasheed
 
PPTX
Basic SQL and History
SomeshwarMoholkar
 
Database Indexes
Sperasoft
 
Physical architecture of sql server
Divya Sharma
 
Distributed Database Management System
Hardik Patil
 
MySQL Tutorial For Beginners | Relational Database Management System | MySQL ...
Edureka!
 
Relational database- Fundamentals
Mohammed El Hedhly
 
MySQL and its basic commands
Bwsrang Basumatary
 
SQL Basics
Hammad Rasheed
 
Basic SQL and History
SomeshwarMoholkar
 

What's hot (20)

PPT
MySQL
Gouthaman V
 
PPTX
Sql server
Fajar Baskoro
 
PPTX
Database architecture
VENNILAV6
 
PPT
SQL.ppt
Ranjit273515
 
PPTX
introdution to SQL and SQL functions
farwa waqar
 
PDF
Database Systems - Introduction to SQL (Chapter 3/1)
Vidyasagar Mundroy
 
PPT
Sequences and indexes
Balqees Al.Mubarak
 
PPTX
Difference Between Sql - MySql and Oracle
Steve Johnson
 
PPTX
8. transactions
Amrit Kaur
 
PPTX
Database basics
prachin514
 
PPTX
Database management systems
Joel Briza
 
PDF
Sql a practical introduction
Hasan Kata
 
PPT
Mysql
TSUBHASHRI
 
PPT
DBMS an Example
Dr. C.V. Suresh Babu
 
PPTX
Sql server basics
VishalJharwade
 
PPTX
Normalization in a Database
Bishrul Haq
 
PPTX
Data base management system and Architecture ppt.
AnkitAbhilashSwain
 
PPT
SQL Tutorial - Basic Commands
1keydata
 
PPT
Sql Server Basics
rainynovember12
 
Sql server
Fajar Baskoro
 
Database architecture
VENNILAV6
 
SQL.ppt
Ranjit273515
 
introdution to SQL and SQL functions
farwa waqar
 
Database Systems - Introduction to SQL (Chapter 3/1)
Vidyasagar Mundroy
 
Sequences and indexes
Balqees Al.Mubarak
 
Difference Between Sql - MySql and Oracle
Steve Johnson
 
8. transactions
Amrit Kaur
 
Database basics
prachin514
 
Database management systems
Joel Briza
 
Sql a practical introduction
Hasan Kata
 
Mysql
TSUBHASHRI
 
DBMS an Example
Dr. C.V. Suresh Babu
 
Sql server basics
VishalJharwade
 
Normalization in a Database
Bishrul Haq
 
Data base management system and Architecture ppt.
AnkitAbhilashSwain
 
SQL Tutorial - Basic Commands
1keydata
 
Sql Server Basics
rainynovember12
 
Ad

Similar to SQL server management studio (20)

PPT
Sql – Structured Query Language
pandey3045_bit
 
PPTX
Lecture - MY-SQL/ SQL Commands - DDL.pptx
umershah0263
 
PPTX
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 10,11&12.pptx
KrishnaRoy45
 
PPTX
Unit - II.pptx
MrsSavitaKumbhare
 
PPTX
DBMS Commands DDL DML DCL ENTITY RELATIONSHIP.pptx
Tulasi72
 
PPTX
SQL: Data Definition Language commands.pptx
PallaviPatil905338
 
PPTX
database language ppt.pptx
Anusha sivakumar
 
PPTX
Fundamentals of Database management system Lab Manual.pptx
Getnet Tigabie Askale -(GM)
 
PDF
SQL-Notes.pdf mba students database note
MrSushilMaurya
 
PDF
SQL Notes
JitendraYadav351971
 
PPTX
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
EliasPetros
 
PPTX
Lab
neelam_rawat
 
PDF
225523359001djcj4_DBMS_LAB_THEORY_DML.pdf
sahilurrahemankhan
 
PPTX
MS SQL - Database Programming Concepts by RSolutions
RSolutions
 
PPTX
Himani uppal-221302130 WP ppt.pptx
MohitYadav889220
 
PDF
Introduction to SQL and Data Defination Language Commands
priyanaik70
 
PPTX
SQL - DML and DDL Commands
Shrija Madhu
 
PPTX
Oracle Database DML DDL and TCL
Abdul Rehman
 
PPTX
Using Basic Structured Query Language lo1.pptx
TsedaleBayabil
 
PPTX
DML Statements.pptx
UnitedGamer1
 
Sql – Structured Query Language
pandey3045_bit
 
Lecture - MY-SQL/ SQL Commands - DDL.pptx
umershah0263
 
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 10,11&12.pptx
KrishnaRoy45
 
Unit - II.pptx
MrsSavitaKumbhare
 
DBMS Commands DDL DML DCL ENTITY RELATIONSHIP.pptx
Tulasi72
 
SQL: Data Definition Language commands.pptx
PallaviPatil905338
 
database language ppt.pptx
Anusha sivakumar
 
Fundamentals of Database management system Lab Manual.pptx
Getnet Tigabie Askale -(GM)
 
SQL-Notes.pdf mba students database note
MrSushilMaurya
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
EliasPetros
 
225523359001djcj4_DBMS_LAB_THEORY_DML.pdf
sahilurrahemankhan
 
MS SQL - Database Programming Concepts by RSolutions
RSolutions
 
Himani uppal-221302130 WP ppt.pptx
MohitYadav889220
 
Introduction to SQL and Data Defination Language Commands
priyanaik70
 
SQL - DML and DDL Commands
Shrija Madhu
 
Oracle Database DML DDL and TCL
Abdul Rehman
 
Using Basic Structured Query Language lo1.pptx
TsedaleBayabil
 
DML Statements.pptx
UnitedGamer1
 
Ad

Recently uploaded (20)

PPTX
Qualification of.UV visible spectrophotometer pptx
shrutipandit17
 
PPTX
RED ROT DISEASE OF SUGARCANE.pptx
BikramjitDeuri
 
PDF
study of microbiologically influenced corrosion of 2205 duplex stainless stee...
ahmadfreak180
 
PDF
Approximating manifold orbits by means of Machine Learning Techniques
Esther Barrabés Vera
 
PPTX
mirna_2025_clase_genética_cinvestav_Dralvarez
Cinvestav
 
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
ESUG
 
PDF
Sujay Rao Mandavilli Multi-barreled appraoch to educational reform FINAL FINA...
Sujay Rao Mandavilli
 
PPT
1a. Basic Principles of Medical Microbiology Part 2 [Autosaved].ppt
separatedwalk
 
PPTX
Hepatopulmonary syndrome power point presentation
raknasivar1997
 
PDF
High-definition imaging of a filamentary connection between a close quasar pa...
Sérgio Sacani
 
PPTX
The Toxic Effects of Aflatoxin B1 and Aflatoxin M1 on Kidney through Regulati...
OttokomaBonny
 
PDF
The Cosmic Symphony: How Photons Shape the Universe and Our Place Within It
kutatomoshi
 
PPTX
Quality control test for plastic & metal.pptx
shrutipandit17
 
PPTX
Pengenalan Sel dan organisasi kehidupanpptx
SuntiEkaprawesti1
 
PDF
Renewable Energy Resources (Solar, Wind, Nuclear, Geothermal) Presentation
RimshaNaeem23
 
PPTX
Reticular formation_nuclei_afferent_efferent
muralinath2
 
PPTX
Internal Capsule_Divisions_fibres_lesions
muralinath2
 
PPTX
Hericium erinaceus, also known as lion's mane mushroom
TinaDadkhah1
 
PPTX
Q1_Science 8_Week4-Day 5.pptx science re
AizaRazonado
 
PPT
Grade_9_Science_Atomic_S_t_r_u_cture.ppt
QuintReynoldDoble
 
Qualification of.UV visible spectrophotometer pptx
shrutipandit17
 
RED ROT DISEASE OF SUGARCANE.pptx
BikramjitDeuri
 
study of microbiologically influenced corrosion of 2205 duplex stainless stee...
ahmadfreak180
 
Approximating manifold orbits by means of Machine Learning Techniques
Esther Barrabés Vera
 
mirna_2025_clase_genética_cinvestav_Dralvarez
Cinvestav
 
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
ESUG
 
Sujay Rao Mandavilli Multi-barreled appraoch to educational reform FINAL FINA...
Sujay Rao Mandavilli
 
1a. Basic Principles of Medical Microbiology Part 2 [Autosaved].ppt
separatedwalk
 
Hepatopulmonary syndrome power point presentation
raknasivar1997
 
High-definition imaging of a filamentary connection between a close quasar pa...
Sérgio Sacani
 
The Toxic Effects of Aflatoxin B1 and Aflatoxin M1 on Kidney through Regulati...
OttokomaBonny
 
The Cosmic Symphony: How Photons Shape the Universe and Our Place Within It
kutatomoshi
 
Quality control test for plastic & metal.pptx
shrutipandit17
 
Pengenalan Sel dan organisasi kehidupanpptx
SuntiEkaprawesti1
 
Renewable Energy Resources (Solar, Wind, Nuclear, Geothermal) Presentation
RimshaNaeem23
 
Reticular formation_nuclei_afferent_efferent
muralinath2
 
Internal Capsule_Divisions_fibres_lesions
muralinath2
 
Hericium erinaceus, also known as lion's mane mushroom
TinaDadkhah1
 
Q1_Science 8_Week4-Day 5.pptx science re
AizaRazonado
 
Grade_9_Science_Atomic_S_t_r_u_cture.ppt
QuintReynoldDoble
 

SQL server management studio

  • 1. Microsoft SQL server Lecture : four Lecturer :Ashna nazm hamasalh [email protected] Kirkuk institute for computer science 1 lecturer.Miss.Ashna Nazm Hamasalh
  • 2. outline Microsoft SQL SERVER SQL Parts DDL STATEMENTS 2 lecturer.Miss.Ashna Nazm Hamasalh
  • 3. DDL STATEMENTS • To create a Database – Syntax : CREATE DATABASE dbname; – Example: CREATE DATABASE my_db; • To Use a database – Syntax : Use dbname; – Example: Use my_db; 3 lecturer.Miss.Ashna Nazm Hamasalh
  • 4. 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) ); 4 lecturer.Miss.Ashna Nazm Hamasalh
  • 5. DDL - Altering a table • ALTER TABLE Persons ADD email VARCHAR(60); • ALTER TABLE Persons DROP COLUMN city; • exec sp_rename 'Table_1.email','fullname','column'; • DDL - Deleting a Table • DROP TABLE table_name ; 5 lecturer.Miss.Ashna Nazm Hamasalh
  • 6. 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. 6 lecturer.Miss.Ashna Nazm Hamasalh
  • 7. • 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 Whereconditions_to_satisfy ; 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. What_to_select indicates what you want to see. This can be a list of columns or * to indicate “all columns”. 7 lecturer.Miss.Ashna Nazm Hamasalh
  • 8. DML - Example • Select * from person; • Select id,firstname from person; • Select * from person where city=‘banglore’ 8 lecturer.Miss.Ashna Nazm Hamasalh
  • 9. • 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'; 9 lecturer.Miss.Ashna Nazm Hamasalh
  • 10. • Delete Query Syntax: DELETE FROM table_name WHERE some_column=some_value; Example : DELETE FROM Customers WHERE CustomerName=‘baabtra' AND ContactName='Maria'; 10 lecturer.Miss.Ashna Nazm Hamasalh