SlideShare a Scribd company logo
MIS 301 RELATIONAL DATABASE
MANAGEMENT SYSTEM
DATABASE MANAGEMENT SYSTEM
Structured Query Language(SQL)-2
LECTURE 10,11,12
PROF. KRISHNA ROY
Types of SQL Commands
•DDL or Data Definition Language Command
• DML or Data Manipulation Language Command
•DCL or Data Control Language Command
• TCL or Transaction Control Language Command
• DQL or Data Query Language Command
PROF. KRISHNA ROY, FMS, BCREC 2
20-09-2023
Data definition language
• DDL is used for creating table structures, modifying existing
structures as well as for removing such structures
• DDL commands are auto-committed i.e. changes made by these
commands are permanently saved in the database.
• DDL commands are CREATE, ALTER, DROP, TRUNCATE
PROF. KRISHNA ROY, FMS, BCREC 3
20-09-2023
ddl command create
• This command creates a new table in the database.
• Syntax:
create table <table name>
( attrib1 datatype(size),
attrib2 datatype(size),
: :
attribn datatype(size));
• Example:
create table student
( roll_no char(10),
name char(20)
dt_of_birth date,
stream char(10)
city char(10),
marks number(5,1));
PROF. KRISHNA ROY, FMS, BCREC 4
20-09-2023
ddl command create
The following constraints are commonly used with the CREATE TABLE command
• NOT NULL - Ensures that a column cannot have a NULL value
• UNIQUE - Ensures that all values in a column are different
• PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row
in a table
• FOREIGN KEY - Uniquely identifies a row/record in another table
• CHECK - Ensures that all values in a column satisfies a specific condition
• DEFAULT - Sets a default value for a column when no value is specified
Example:
create table student
( roll_no char(10) not null primary key,
name char(20) not null,
dt_of_birth date,
mob_no number(10) unique,
stream char(10) check (stream in (‘Marketing’,’MIS’,’Finance’,’HR’)
city_code char(10) foreign key references city(city_code) default ‘Durgapur’,
marks number(5,1));
PROF. KRISHNA ROY, FMS, BCREC 5
20-09-2023
DDl command alter
• Alter command is used for changing the table structure.
• Alter command with the add clause adds new attribute definitions to an
existing table.
• Syntax with add clause
alter table <table name>
add ( attrib1 datatype(size),
: :
attribn datatype(size));
• Example
alter table student
add ( fname char(20),
result bool);
PROF. KRISHNA ROY, FMS, BCREC 6
20-09-2023
DDl command alter
• Alter command is used for changing the table structure.
• Alter command with the modify clause changes the type and size of existing
attributes.
• Syntax with modify clause
alter table <table name>
modify ( attrib1 datatype(size),
: :
attribn datatype(size));
• Example
alter table student
modify( roll_no number(10),
name char(30));
PROF. KRISHNA ROY, FMS, BCREC 7
20-09-2023
DDl command drop
• Drop command is used for removing the table structure
along with contents.
• Syntax
drop table <table name>;
• Example
drop table student;
PROF. KRISHNA ROY, FMS, BCREC 8
20-09-2023
DDl command truncate
• Truncate command is used for removing the table
contents and not the table definition.
• Syntax
truncate table <table name>;
• Example
truncate table student;
PROF. KRISHNA ROY, FMS, BCREC 9
20-09-2023
Data manipulation language
• DML is used for changing contents of the database
• DML commands are not auto-committed i.e. changes made by
these commands are not permanently saved in the database and
can be rolled back.
• DML commands are INSERT, UPDATE AND DELETE.
PROF. KRISHNA ROY, FMS, BCREC 10
20-09-2023
DML command insert
• The insert command is used for adding a row of data or record into a table
• There are more or less three variations of the insert command
as follows:
1. insert into <tablename>
values(val1, val2, ……, valn); here the field values must be provided
sequentially. No field value may be omitted though it may be replaced by
NULL(representing absence of a value)
Example:
insert into student values(123,’John’,’25-Mar-97’, ’marketing’, ’Durgapur’, 81.5, ’Robbins’, TRUE);
PROF. KRISHNA ROY, FMS, BCREC 11
20-09-2023
DML command insert
• The insert command is used for adding a row of data or record
into a table
• There are more or less three variations of the insert command
as follows:
2. insert into <tablename> (attrib1, attrib2,…, attribn)
values(val1, val2, ……, valn); here the field values must be
provided only for mentioned attributes in the mentioned sequence.
Example:
insert into student(name,marks,result,roll_no) values(‘Nikhil’, 75.0,TRUE,212);
PROF. KRISHNA ROY, FMS, BCREC 12
20-09-2023
DML command insert
• The insert command is used for adding a row of data or record into a table
• There are more or less three variations of the insert command
as follows:
3. insert into <tablename> (attrib1, attrib2,…, attribn)
values(&val1, &val2, ……, &valn); here the field values are input at runtime after
prompting and then the accepted entries are inserted as a record.
Example:
insert into student(name,marks,result,roll_no) values(‘&name’, &marks, &result, &roll_no);
Enter value for name: Girish
Enter value for marks: 25.5
Enter value for result: FALSE
Enter value for roll_no: 102
 Every time this command(macro substitution) is repeated, a new record can be input by the user with new values. The first
2 formats of insert, if repeated, insert duplicate records.
PROF. KRISHNA ROY, FMS, BCREC 13
20-09-2023
DML command update
• The update command is used for modifying/changing the content of a table
• In absence of the where clause , update command updates all the records
• The set clause is used to assign a constant value or an expression(after evaluation)
to an attribute in a tuple.
• Syntax: update <table name> set attrib1=value/expr, attrib2=value/expr, ……;
• Example: update student set stream=‘Finance’, marks=marks+10;
Stream for all students are set to Finance irrespective of their previous stream and
everyone’s marks are increased by 10
• In presence of the where clause, only the records satisfying the where clause are updated.
• Syntax: update <table name> set attrib1=value/expr, attrib2=value/expr, … where condition;
• Example: update student set stream=‘Finance’, marks=marks+10 where city=‘Durgapur’ and marks<33;
Stream for students residing in Durgapur and having obtained less than 33 marks are set to
Finance irrespective of their previous stream and their marks are increased by 10
PROF. KRISHNA ROY, FMS, BCREC 14
20-09-2023
DML command delete
• The delete command is used for removing entire records/tuples from a table
• In absence of the where clause , delete removes all the records from the table.
• If where clause is used then the records satisfying the where clause only, are
deleted.
• Syntax: delete from <table name>;
• Example: delete from student;
All student records are deleted leaving the empty table structure/definition.
• In presence of the where clause, only the records satisfying the where clause are updated.
• Syntax: delete from <table name> where condition;
• Example: delete from student where marks<33;
Records of students securing less than 33 are deleted. Rest of the records remain intact.
• delete either deletes entire records or not at all . Part of the record i.e. some of the
attributes can not be deleted using this command
PROF. KRISHNA ROY, FMS, BCREC 15
20-09-2023
• Till we meet again in the next class……….
PROF. KRISHNA ROY, FMS, BCREC 16
20-09-2023

More Related Content

Similar to MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 10,11&12.pptx

SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
Sharad Dubey
 
Sqlbysandeep
SqlbysandeepSqlbysandeep
Sqlbysandeep
sandeepkhandare1183
 
SQL commands
SQL commandsSQL commands
SQL commands
GirdharRatne
 
Lab
LabLab
8. sql
8. sql8. sql
8. sql
khoahuy82
 
DDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using OracleDDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using Oracle
Farhan Aslam
 
STRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGESTRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGE
SarithaDhanapal
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql newSANTOSH RATH
 
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
RaviRajput416403
 
Creating a database
Creating a databaseCreating a database
Creating a databaseRahul Gupta
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
Mohd Tousif
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
Rc Os
 
Structured Query Language(SQL)
Structured Query Language(SQL)Structured Query Language(SQL)
Structured Query Language(SQL)
PadmapriyaA6
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
SQL: Introduction and its Basic Commands
SQL: Introduction and its Basic CommandsSQL: Introduction and its Basic Commands
SQL: Introduction and its Basic Commands
niyantadesai7
 
COMMANDS PPT(1).pdf
COMMANDS PPT(1).pdfCOMMANDS PPT(1).pdf
COMMANDS PPT(1).pdf
BrahmamKolli
 

Similar to MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 10,11&12.pptx (20)

SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
Sql statement,functions and joins
Sql statement,functions and joinsSql statement,functions and joins
Sql statement,functions and joins
 
Sqlbysandeep
SqlbysandeepSqlbysandeep
Sqlbysandeep
 
SQL commands
SQL commandsSQL commands
SQL commands
 
Oracle sql material
Oracle sql materialOracle sql material
Oracle sql material
 
Lab
LabLab
Lab
 
8. sql
8. sql8. sql
8. sql
 
DDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using OracleDDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using Oracle
 
STRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGESTRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGE
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
 
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
 
Creating a database
Creating a databaseCreating a database
Creating a database
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
 
Structured Query Language(SQL)
Structured Query Language(SQL)Structured Query Language(SQL)
Structured Query Language(SQL)
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
SQL: Introduction and its Basic Commands
SQL: Introduction and its Basic CommandsSQL: Introduction and its Basic Commands
SQL: Introduction and its Basic Commands
 
COMMANDS PPT(1).pdf
COMMANDS PPT(1).pdfCOMMANDS PPT(1).pdf
COMMANDS PPT(1).pdf
 

More from KrishnaRoy45

MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 2&3.pptx
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 2&3.pptxMIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 2&3.pptx
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 2&3.pptx
KrishnaRoy45
 
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 1.pptx
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 1.pptxMIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 1.pptx
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 1.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 17.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  17.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  17.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 17.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 15&16.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  15&16.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  15&16.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 15&16.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 6&7.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 6&7.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 6&7.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 6&7.pptx
KrishnaRoy45
 
MB301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 9&10.pptx
MB301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 9&10.pptxMB301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 9&10.pptx
MB301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 9&10.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 5.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 5.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 5.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 5.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 11&12.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 11&12.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 11&12.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 11&12.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 19.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  19.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  19.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 19.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 3.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 3.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 3.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 3.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 13&14.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  13&14.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  13&14.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 13&14.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 1.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 1.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 1.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 1.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 2.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 2.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 2.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 2.pptx
KrishnaRoy45
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 18.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  18.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  18.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 18.pptx
KrishnaRoy45
 
MB 103 business communication 5_6.pptx
MB 103 business communication 5_6.pptxMB 103 business communication 5_6.pptx
MB 103 business communication 5_6.pptx
KrishnaRoy45
 
MB 103 business communication 7_8.pptx
MB 103 business communication 7_8.pptxMB 103 business communication 7_8.pptx
MB 103 business communication 7_8.pptx
KrishnaRoy45
 
MB 103 business communication 3_4.pptx
MB 103 business communication 3_4.pptxMB 103 business communication 3_4.pptx
MB 103 business communication 3_4.pptx
KrishnaRoy45
 
MB 103 business communication 9_10.pptx
MB 103 business communication 9_10.pptxMB 103 business communication 9_10.pptx
MB 103 business communication 9_10.pptx
KrishnaRoy45
 
MB 103 business communication 2.pptx
MB 103 business communication 2.pptxMB 103 business communication 2.pptx
MB 103 business communication 2.pptx
KrishnaRoy45
 
MB 103 business communication 1.pptx
MB 103 business communication 1.pptxMB 103 business communication 1.pptx
MB 103 business communication 1.pptx
KrishnaRoy45
 

More from KrishnaRoy45 (20)

MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 2&3.pptx
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 2&3.pptxMIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 2&3.pptx
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 2&3.pptx
 
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 1.pptx
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 1.pptxMIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 1.pptx
MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 1.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 17.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  17.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  17.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 17.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 15&16.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  15&16.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  15&16.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 15&16.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 6&7.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 6&7.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 6&7.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 6&7.pptx
 
MB301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 9&10.pptx
MB301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 9&10.pptxMB301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 9&10.pptx
MB301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 9&10.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 5.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 5.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 5.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 5.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 11&12.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 11&12.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 11&12.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 11&12.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 19.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  19.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  19.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 19.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 3.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 3.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 3.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 3.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 13&14.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  13&14.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  13&14.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 13&14.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 1.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 1.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 1.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 1.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 2.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 2.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 2.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 2.pptx
 
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 18.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  18.pptxMB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT  18.pptx
MB 301 ENTREPRENEURSHIP & PROJECT MANAGEMENT 18.pptx
 
MB 103 business communication 5_6.pptx
MB 103 business communication 5_6.pptxMB 103 business communication 5_6.pptx
MB 103 business communication 5_6.pptx
 
MB 103 business communication 7_8.pptx
MB 103 business communication 7_8.pptxMB 103 business communication 7_8.pptx
MB 103 business communication 7_8.pptx
 
MB 103 business communication 3_4.pptx
MB 103 business communication 3_4.pptxMB 103 business communication 3_4.pptx
MB 103 business communication 3_4.pptx
 
MB 103 business communication 9_10.pptx
MB 103 business communication 9_10.pptxMB 103 business communication 9_10.pptx
MB 103 business communication 9_10.pptx
 
MB 103 business communication 2.pptx
MB 103 business communication 2.pptxMB 103 business communication 2.pptx
MB 103 business communication 2.pptx
 
MB 103 business communication 1.pptx
MB 103 business communication 1.pptxMB 103 business communication 1.pptx
MB 103 business communication 1.pptx
 

Recently uploaded

社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
NABLAS株式会社
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
enxupq
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
ahzuo
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
MaleehaSheikh2
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
vcaxypu
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Subhajit Sahu
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
Opendatabay
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
ewymefz
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
TravisMalana
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
vcaxypu
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
benishzehra469
 

Recently uploaded (20)

社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
 

MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM 10,11&12.pptx

  • 1. MIS 301 RELATIONAL DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM Structured Query Language(SQL)-2 LECTURE 10,11,12 PROF. KRISHNA ROY
  • 2. Types of SQL Commands •DDL or Data Definition Language Command • DML or Data Manipulation Language Command •DCL or Data Control Language Command • TCL or Transaction Control Language Command • DQL or Data Query Language Command PROF. KRISHNA ROY, FMS, BCREC 2 20-09-2023
  • 3. Data definition language • DDL is used for creating table structures, modifying existing structures as well as for removing such structures • DDL commands are auto-committed i.e. changes made by these commands are permanently saved in the database. • DDL commands are CREATE, ALTER, DROP, TRUNCATE PROF. KRISHNA ROY, FMS, BCREC 3 20-09-2023
  • 4. ddl command create • This command creates a new table in the database. • Syntax: create table <table name> ( attrib1 datatype(size), attrib2 datatype(size), : : attribn datatype(size)); • Example: create table student ( roll_no char(10), name char(20) dt_of_birth date, stream char(10) city char(10), marks number(5,1)); PROF. KRISHNA ROY, FMS, BCREC 4 20-09-2023
  • 5. ddl command create The following constraints are commonly used with the CREATE TABLE command • NOT NULL - Ensures that a column cannot have a NULL value • UNIQUE - Ensures that all values in a column are different • PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table • FOREIGN KEY - Uniquely identifies a row/record in another table • CHECK - Ensures that all values in a column satisfies a specific condition • DEFAULT - Sets a default value for a column when no value is specified Example: create table student ( roll_no char(10) not null primary key, name char(20) not null, dt_of_birth date, mob_no number(10) unique, stream char(10) check (stream in (‘Marketing’,’MIS’,’Finance’,’HR’) city_code char(10) foreign key references city(city_code) default ‘Durgapur’, marks number(5,1)); PROF. KRISHNA ROY, FMS, BCREC 5 20-09-2023
  • 6. DDl command alter • Alter command is used for changing the table structure. • Alter command with the add clause adds new attribute definitions to an existing table. • Syntax with add clause alter table <table name> add ( attrib1 datatype(size), : : attribn datatype(size)); • Example alter table student add ( fname char(20), result bool); PROF. KRISHNA ROY, FMS, BCREC 6 20-09-2023
  • 7. DDl command alter • Alter command is used for changing the table structure. • Alter command with the modify clause changes the type and size of existing attributes. • Syntax with modify clause alter table <table name> modify ( attrib1 datatype(size), : : attribn datatype(size)); • Example alter table student modify( roll_no number(10), name char(30)); PROF. KRISHNA ROY, FMS, BCREC 7 20-09-2023
  • 8. DDl command drop • Drop command is used for removing the table structure along with contents. • Syntax drop table <table name>; • Example drop table student; PROF. KRISHNA ROY, FMS, BCREC 8 20-09-2023
  • 9. DDl command truncate • Truncate command is used for removing the table contents and not the table definition. • Syntax truncate table <table name>; • Example truncate table student; PROF. KRISHNA ROY, FMS, BCREC 9 20-09-2023
  • 10. Data manipulation language • DML is used for changing contents of the database • DML commands are not auto-committed i.e. changes made by these commands are not permanently saved in the database and can be rolled back. • DML commands are INSERT, UPDATE AND DELETE. PROF. KRISHNA ROY, FMS, BCREC 10 20-09-2023
  • 11. DML command insert • The insert command is used for adding a row of data or record into a table • There are more or less three variations of the insert command as follows: 1. insert into <tablename> values(val1, val2, ……, valn); here the field values must be provided sequentially. No field value may be omitted though it may be replaced by NULL(representing absence of a value) Example: insert into student values(123,’John’,’25-Mar-97’, ’marketing’, ’Durgapur’, 81.5, ’Robbins’, TRUE); PROF. KRISHNA ROY, FMS, BCREC 11 20-09-2023
  • 12. DML command insert • The insert command is used for adding a row of data or record into a table • There are more or less three variations of the insert command as follows: 2. insert into <tablename> (attrib1, attrib2,…, attribn) values(val1, val2, ……, valn); here the field values must be provided only for mentioned attributes in the mentioned sequence. Example: insert into student(name,marks,result,roll_no) values(‘Nikhil’, 75.0,TRUE,212); PROF. KRISHNA ROY, FMS, BCREC 12 20-09-2023
  • 13. DML command insert • The insert command is used for adding a row of data or record into a table • There are more or less three variations of the insert command as follows: 3. insert into <tablename> (attrib1, attrib2,…, attribn) values(&val1, &val2, ……, &valn); here the field values are input at runtime after prompting and then the accepted entries are inserted as a record. Example: insert into student(name,marks,result,roll_no) values(‘&name’, &marks, &result, &roll_no); Enter value for name: Girish Enter value for marks: 25.5 Enter value for result: FALSE Enter value for roll_no: 102  Every time this command(macro substitution) is repeated, a new record can be input by the user with new values. The first 2 formats of insert, if repeated, insert duplicate records. PROF. KRISHNA ROY, FMS, BCREC 13 20-09-2023
  • 14. DML command update • The update command is used for modifying/changing the content of a table • In absence of the where clause , update command updates all the records • The set clause is used to assign a constant value or an expression(after evaluation) to an attribute in a tuple. • Syntax: update <table name> set attrib1=value/expr, attrib2=value/expr, ……; • Example: update student set stream=‘Finance’, marks=marks+10; Stream for all students are set to Finance irrespective of their previous stream and everyone’s marks are increased by 10 • In presence of the where clause, only the records satisfying the where clause are updated. • Syntax: update <table name> set attrib1=value/expr, attrib2=value/expr, … where condition; • Example: update student set stream=‘Finance’, marks=marks+10 where city=‘Durgapur’ and marks<33; Stream for students residing in Durgapur and having obtained less than 33 marks are set to Finance irrespective of their previous stream and their marks are increased by 10 PROF. KRISHNA ROY, FMS, BCREC 14 20-09-2023
  • 15. DML command delete • The delete command is used for removing entire records/tuples from a table • In absence of the where clause , delete removes all the records from the table. • If where clause is used then the records satisfying the where clause only, are deleted. • Syntax: delete from <table name>; • Example: delete from student; All student records are deleted leaving the empty table structure/definition. • In presence of the where clause, only the records satisfying the where clause are updated. • Syntax: delete from <table name> where condition; • Example: delete from student where marks<33; Records of students securing less than 33 are deleted. Rest of the records remain intact. • delete either deletes entire records or not at all . Part of the record i.e. some of the attributes can not be deleted using this command PROF. KRISHNA ROY, FMS, BCREC 15 20-09-2023
  • 16. • Till we meet again in the next class………. PROF. KRISHNA ROY, FMS, BCREC 16 20-09-2023