SlideShare a Scribd company logo
SQL and Integrity
Constraints
By:D-Mishra
Concept of DDL, DML, DCL
Structured Query Language(SQL) as we all know is the
database language by the use of which we can perform
certain operations on the existing database and also we
can use this language to create a database. Sql uses
certain commands like Create, Drop, Insert, etc.
DDL – Data Definition Language
Data Definition Language actually consists of the SQL commands that
can be used to define the database schema. It simply deals with
descriptions of the database schema and is used to create and modify
the structure of database objects in the database.DDL is a set of SQL
commands used to create, modify, and delete database structures but
not data. These commands are normally not used by a general user,
who should be accessing the database via an application.
● CREATE: This command is used to create the database or its objects
(like table, index, function, views, store procedure, and triggers).
● DROP: This command is used to delete objects from the database.
● ALTER: This is used to alter the structure of the database.
● TRUNCATE: This is used to remove all records from a table,
including all spaces allocated for the records are removed.
● COMMENT: This is used to add comments to the data dictionary.
● RENAME: This is used to rename an object existing in the database.
DQL (Data Query Language)
DQL statements are used for performing queries on the data within
schema objects. The purpose of the DQL Command is to get some
schema relation based on the query passed to it. We can define
DQL as follows it is a component of SQL statement that allows
getting data from the database and imposing order upon it. It
includes the SELECT statement. This command allows getting the
data out of the database to perform operations with it. When a
SELECT is fired against a table or tables the result is compiled into
a further temporary table, which is displayed or perhaps received
by the program i.e. a front-end.
● SELECT: It is used to retrieve data from the database.
DML(Data Manipulation Language)
DML or Data Manipulation Language and this includes most of
the SQL statements. It is the component of the SQL statement
that controls access to data and to the database. Basically, DCL
statements are grouped with DML statements
● INSERT: It is used to insert data into a table.
● UPDATE: It is used to update existing data within a
table.
● DELETE : It is used to delete records from a database
table.
● LOCK: Table control concurrency.
● CALL: Call a PL/SQL or JAVA subprogram.
● EXPLAIN PLAN: It describes the access path to data.
DCL (Data Control Language)
DCL includes commands such as GRANT and REVOKE which mainly
deal with the rights, permissions, and other controls of the database
system.
● GRANT:This command gives users access privileges to the database.
● REVOKE: This command withdraws the user’s access privileges given by using the GRANT command.
Basic Structure
● Applications: – It can be considered as a user-friendly web
page where the user enters the requests. Here he simply...
● End User: – They are the real users of the database. They
can be developers, designers, administrators, or the
actual...
● DDL: – Data Definition Language (DDL) is a query fired to
create database, schema, tables, mappings, etc in the
database.
● DDL Compiler: – This part of the database is responsible
for processing the DDL commands. That means this
compiler...
Set operations
Union
Union combines two different results obtained by a query into a single result in the form of
a table. However, the results should be similar if union is to be applied on them.
Syntex:
Select Student_Name from Art_Students
UNION
Select Student_Name from Dance_Students
Intersection
The intersection operator gives the common data values between the two data
sets that are intersected. The two data sets that are intersected should be similar
for the intersection operator to work. Intersection also removes all duplicates
before displaying the result.
Syntex:
Select Student_Name from Art_Students
INTERSECT
Select Student_Name from Dance_Students
Aggregate Functions
COUNT FUNCTION
● COUNT function is used to Count the number of rows in a database table. It can work on both numeric and non-
numeric data types.
● COUNT function uses the COUNT(*) that returns the count of all the rows in a specified table. COUNT(*)
considers duplicate and Null.
Syntax
1. COUNT(*)
2. or
3. COUNT( [ALL|DISTINCT] expression )
SUM Function
Sum function is used to calculate the sum of all selected columns. It works on numeric fields only.
Syntax
1. SUM()
2. or
3. SUM( [ALL|DISTINCT] expression )
AVG function
The AVG function is used to calculate the average value of the numeric type. AVG function returns the average of all
non-Null values.
Syntax
1. AVG()
2. or
3. AVG( [ALL|DISTINCT] expression )
MAX Function
MAX function is used to find the maximum value of a certain column. This function determines the largest value of all
selected values of a column.
Syntax
MAX()
1. or
2. MAX( [ALL|DISTINCT] expression )
MIN Function
MIN function is used to find the minimum value of a certain column. This function determines the smallest value of all selected
values of a column.
Syntax
1. MIN()
2. or
3. MIN( [ALL|DISTINCT] expression )
Domain constraints in DBMS
● Domain constraints
● Entity Integrity constraints
● Referential Integrity constraints
● Key constraints
Domain Constraints
Domain Constraints are user-defined columns that help the user
to enter the value according to the data type. And if it encounters
a wrong input it gives the message to the user that the column is
not fulfilled properly. Or in other words, it is an attribute that
specifies all the possible values that the attribute can hold like
integer, character, date, time, string, etc.
Domain Constraints – Not Null: Null values are the values that are unassigned or we can also say that which are
unknown or the missing attribute values and by default, a column can hold the null values.
Create table employee
(employee_id varchar(30),
employee_name varchar(30) not null,
salary NUMBER);
Domain Constraints – Check: It defines a condition that each row must satisfy which means it restricts the
value of a column between ranges or we can say that it is just like a condition or filter checking before saving
data into a column. It ensures that when a tuple is inserted inside the relation must satisfy the predicate
given in the check clause.
Create table employee
(employee_id varchar(30) not
null check(employee_id > 0),
employee_name varchar(30),
salary NUMBER);
Integrity Constraints
Domain constraints
● Domain constraints can be defined as the definition of a valid set of
values for an attribute.
● The data type of domain includes string, character, integer, time, date,
currency, etc. The value of the attribute must be available in the
corresponding domain.
Entity integrity constraints
● The entity integrity constraint states that primary key value can't be null.
● This is because the primary key value is used to identify individual rows in
relation and if the primary key has a null value, then we can't identify those
rows.
● A table can contain a null value other than the primary key field.
Referential Integrity Constraints
● A referential integrity constraint is specified between two tables.
● In the Referential integrity constraints, if a foreign key in Table 1
refers to the Primary Key of Table 2, then every value of the Foreign
Key in Table 1 must be null or be available in Table 2.
Key constraints
● Keys are the entity set that is used to identify an entity within its entity
set uniquely.
● An entity set can have multiple keys, but out of which one key will be
the primary key. A primary key can contain a unique and null value in
the relational table.
SQL and Integrity Constraints (2).pptx
SQL and Integrity Constraints (2).pptx

More Related Content

Similar to SQL and Integrity Constraints (2).pptx

Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)
Muhammed Thanveer M
 
Mysql
MysqlMysql
Mysql
TSUBHASHRI
 
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQLDATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
Dev Chauhan
 
Database testing
Database testingDatabase testing
Database testing
Pesara Swamy
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
Sheethal Aji Mani
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
RareDeath
 
Adbms
AdbmsAdbms
Adbms
jass12345
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
Aditya Kumar Tripathy
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
Prathap Narayanappa
 
4.Database Management System.pdf
4.Database Management System.pdf4.Database Management System.pdf
4.Database Management System.pdf
Export Promotion Bureau
 
ADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASADADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASAD
PADYALAMAITHILINATHA
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
Abrar ali
 
12 SQL
12 SQL12 SQL
12 SQL
12 SQL12 SQL
Database programming
Database programmingDatabase programming
lovely
lovelylovely
lovely
love0323
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
NIVETHA37590
 
Sql server
Sql serverSql server
Sql server
Puja Gupta
 
Dbms
DbmsDbms
Ankit
AnkitAnkit

Similar to SQL and Integrity Constraints (2).pptx (20)

Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)
 
Mysql
MysqlMysql
Mysql
 
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQLDATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
 
Database testing
Database testingDatabase testing
Database testing
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
 
Adbms
AdbmsAdbms
Adbms
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
 
4.Database Management System.pdf
4.Database Management System.pdf4.Database Management System.pdf
4.Database Management System.pdf
 
ADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASADADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASAD
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
12 SQL
12 SQL12 SQL
12 SQL
 
12 SQL
12 SQL12 SQL
12 SQL
 
Database programming
Database programmingDatabase programming
Database programming
 
lovely
lovelylovely
lovely
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 
Sql server
Sql serverSql server
Sql server
 
Dbms
DbmsDbms
Dbms
 
Ankit
AnkitAnkit
Ankit
 

Recently uploaded

writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 

Recently uploaded (20)

writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 

SQL and Integrity Constraints (2).pptx

  • 2. Concept of DDL, DML, DCL Structured Query Language(SQL) as we all know is the database language by the use of which we can perform certain operations on the existing database and also we can use this language to create a database. Sql uses certain commands like Create, Drop, Insert, etc.
  • 3.
  • 4. DDL – Data Definition Language Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database.DDL is a set of SQL commands used to create, modify, and delete database structures but not data. These commands are normally not used by a general user, who should be accessing the database via an application.
  • 5. ● CREATE: This command is used to create the database or its objects (like table, index, function, views, store procedure, and triggers). ● DROP: This command is used to delete objects from the database. ● ALTER: This is used to alter the structure of the database. ● TRUNCATE: This is used to remove all records from a table, including all spaces allocated for the records are removed. ● COMMENT: This is used to add comments to the data dictionary. ● RENAME: This is used to rename an object existing in the database.
  • 6. DQL (Data Query Language) DQL statements are used for performing queries on the data within schema objects. The purpose of the DQL Command is to get some schema relation based on the query passed to it. We can define DQL as follows it is a component of SQL statement that allows getting data from the database and imposing order upon it. It includes the SELECT statement. This command allows getting the data out of the database to perform operations with it. When a SELECT is fired against a table or tables the result is compiled into a further temporary table, which is displayed or perhaps received by the program i.e. a front-end.
  • 7. ● SELECT: It is used to retrieve data from the database.
  • 8. DML(Data Manipulation Language) DML or Data Manipulation Language and this includes most of the SQL statements. It is the component of the SQL statement that controls access to data and to the database. Basically, DCL statements are grouped with DML statements
  • 9. ● INSERT: It is used to insert data into a table. ● UPDATE: It is used to update existing data within a table. ● DELETE : It is used to delete records from a database table. ● LOCK: Table control concurrency. ● CALL: Call a PL/SQL or JAVA subprogram. ● EXPLAIN PLAN: It describes the access path to data.
  • 10. DCL (Data Control Language) DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the database system. ● GRANT:This command gives users access privileges to the database. ● REVOKE: This command withdraws the user’s access privileges given by using the GRANT command.
  • 12. ● Applications: – It can be considered as a user-friendly web page where the user enters the requests. Here he simply... ● End User: – They are the real users of the database. They can be developers, designers, administrators, or the actual... ● DDL: – Data Definition Language (DDL) is a query fired to create database, schema, tables, mappings, etc in the database. ● DDL Compiler: – This part of the database is responsible for processing the DDL commands. That means this compiler...
  • 13. Set operations Union Union combines two different results obtained by a query into a single result in the form of a table. However, the results should be similar if union is to be applied on them. Syntex: Select Student_Name from Art_Students UNION Select Student_Name from Dance_Students
  • 14. Intersection The intersection operator gives the common data values between the two data sets that are intersected. The two data sets that are intersected should be similar for the intersection operator to work. Intersection also removes all duplicates before displaying the result. Syntex: Select Student_Name from Art_Students INTERSECT Select Student_Name from Dance_Students
  • 16. COUNT FUNCTION ● COUNT function is used to Count the number of rows in a database table. It can work on both numeric and non- numeric data types. ● COUNT function uses the COUNT(*) that returns the count of all the rows in a specified table. COUNT(*) considers duplicate and Null. Syntax 1. COUNT(*) 2. or 3. COUNT( [ALL|DISTINCT] expression )
  • 17. SUM Function Sum function is used to calculate the sum of all selected columns. It works on numeric fields only. Syntax 1. SUM() 2. or 3. SUM( [ALL|DISTINCT] expression )
  • 18. AVG function The AVG function is used to calculate the average value of the numeric type. AVG function returns the average of all non-Null values. Syntax 1. AVG() 2. or 3. AVG( [ALL|DISTINCT] expression )
  • 19. MAX Function MAX function is used to find the maximum value of a certain column. This function determines the largest value of all selected values of a column. Syntax MAX() 1. or 2. MAX( [ALL|DISTINCT] expression )
  • 20. MIN Function MIN function is used to find the minimum value of a certain column. This function determines the smallest value of all selected values of a column. Syntax 1. MIN() 2. or 3. MIN( [ALL|DISTINCT] expression )
  • 21. Domain constraints in DBMS ● Domain constraints ● Entity Integrity constraints ● Referential Integrity constraints ● Key constraints
  • 22. Domain Constraints Domain Constraints are user-defined columns that help the user to enter the value according to the data type. And if it encounters a wrong input it gives the message to the user that the column is not fulfilled properly. Or in other words, it is an attribute that specifies all the possible values that the attribute can hold like integer, character, date, time, string, etc.
  • 23. Domain Constraints – Not Null: Null values are the values that are unassigned or we can also say that which are unknown or the missing attribute values and by default, a column can hold the null values. Create table employee (employee_id varchar(30), employee_name varchar(30) not null, salary NUMBER);
  • 24. Domain Constraints – Check: It defines a condition that each row must satisfy which means it restricts the value of a column between ranges or we can say that it is just like a condition or filter checking before saving data into a column. It ensures that when a tuple is inserted inside the relation must satisfy the predicate given in the check clause. Create table employee (employee_id varchar(30) not null check(employee_id > 0), employee_name varchar(30), salary NUMBER);
  • 26. Domain constraints ● Domain constraints can be defined as the definition of a valid set of values for an attribute. ● The data type of domain includes string, character, integer, time, date, currency, etc. The value of the attribute must be available in the corresponding domain.
  • 27. Entity integrity constraints ● The entity integrity constraint states that primary key value can't be null. ● This is because the primary key value is used to identify individual rows in relation and if the primary key has a null value, then we can't identify those rows. ● A table can contain a null value other than the primary key field.
  • 28. Referential Integrity Constraints ● A referential integrity constraint is specified between two tables. ● In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary Key of Table 2, then every value of the Foreign Key in Table 1 must be null or be available in Table 2.
  • 29. Key constraints ● Keys are the entity set that is used to identify an entity within its entity set uniquely. ● An entity set can have multiple keys, but out of which one key will be the primary key. A primary key can contain a unique and null value in the relational table.