SlideShare a Scribd company logo
1 of 16
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

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
 
COMMANDS PPT(1).pdf
COMMANDS PPT(1).pdfCOMMANDS PPT(1).pdf
COMMANDS PPT(1).pdf
 
sql.pptx
sql.pptxsql.pptx
sql.pptx
 

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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
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.pptxKrishnaRoy45
 
MB 103 business communication 2.pptx
MB 103 business communication 2.pptxMB 103 business communication 2.pptx
MB 103 business communication 2.pptxKrishnaRoy45
 
MB 103 business communication 1.pptx
MB 103 business communication 1.pptxMB 103 business communication 1.pptx
MB 103 business communication 1.pptxKrishnaRoy45
 

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

Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
Data Warehouse , Data Cube Computation
Data Warehouse   , Data Cube ComputationData Warehouse   , Data Cube Computation
Data Warehouse , Data Cube Computationsit20ad004
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Servicejennyeacort
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
Data Warehouse , Data Cube Computation
Data Warehouse   , Data Cube ComputationData Warehouse   , Data Cube Computation
Data Warehouse , Data Cube Computation
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 

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