0% found this document useful (0 votes)
14 views59 pages

Database System

The document provides an overview of Database Management Systems (DBMS), detailing their purpose, advantages, and disadvantages, as well as various architectures and data models. It emphasizes the importance of DBMS in improving data sharing, security, integration, and decision-making while also addressing challenges such as increased costs and management complexity. Additionally, it covers transaction management and the fundamental properties of transactions, known as ACID properties.

Uploaded by

cs7367266
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views59 pages

Database System

The document provides an overview of Database Management Systems (DBMS), detailing their purpose, advantages, and disadvantages, as well as various architectures and data models. It emphasizes the importance of DBMS in improving data sharing, security, integration, and decision-making while also addressing challenges such as increased costs and management complexity. Additionally, it covers transaction management and the fundamental properties of transactions, known as ACID properties.

Uploaded by

cs7367266
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 59

DATABASE

SYSTEM
Database Management System (DBMS)

• Collection of interrelated data


• Set of programs to access the data
• DBMS contains information about a particular enterprise
• DBMS provides an environment that is both convenient and efficient to use.
• Database Applications:
• Banking: all transactions
• Airlines: reservations, schedules
• Universities: registration, grades
• Sales: customers, products, purchases
• Manufacturing: production, inventory, orders, supply chain
• Human resources: employee records, salaries, tax deductions
• Databases touch all aspects of our lives
Purpose of Database System

• In the early days, database applications were built on top of


file systems
• Drawbacks of using file systems to store data:
• Data redundancy and inconsistency
• Multiple file formats, duplication of information in different files
• Difficulty in accessing data
• Need to write a new program to carry out each new task
• Data isolation — multiple files and formats
• Integrity problems
• Integrity constraints (e.g. account balance > 0) become part of
program code
• Hard to add new constraints or change existing ones
Purpose of Database Systems (Cont.)
• Drawbacks of using file systems (cont.)
• Atomicity of updates
• Failures may leave database in an inconsistent state with partial updates
carried out
• E.g. transfer of funds from one account to another should either complete
or not happen at all
• Concurrent access by multiple users
• Concurrent accessed needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
• E.g. two people reading a balance and updating it at the same time
• Security problems
• Database systems offer solutions to all the above problems
Advantage of DBMS

• 1. Improved data sharing:


• The DBMS helps create an environment in which end users have better access to more
and better-managed data.
• Such access makes it possible for end users to respond quickly to changes in their
environment.
• 2. Improved data security:
• The more users access the data, the greater the risks of data security
breaches.Corporations invest considerable amounts of time, effort, and money to ensure
that corporate data are used properly.
• A DBMS provides a framework for better enforcement of data privacy and security policies.
• 3. Better data integration:
• Wider access to well-managed data promotes an integrated view of the organization’s
operations and a clearer view of the big picture.
• It becomes much easier to see how actions in one segment of the company affect other
segments.
• 4. Minimized data inconsistency:
• Data inconsistency exists when different versions of the same data appear in different places.
• For example, data inconsistency exists when a company’s sales department stores a sales representative’s name as “Bill
Brown” and the company’s personnel department stores that same person’s name as “William G. Brown,” or when the
company’s regional sales office shows the price of a product as $45.95 and its national sales office shows the same product’s
price as $43.95.
• The probability of data inconsistency is greatly reduced in a properly designed database.
• 5. Improved data access:
• The DBMS makes it possible to produce quick answers to ad hoc queries.
• From a database perspective, a query is a specific request issued to the DBMS for data manipulation—for example, to read or
update the data. Simply put, a query is a question, and an ad hoc query is a spur-of-the-moment question.
• The DBMS sends back an answer (called the query result set) to the application.
• For example, end users
• 6. Improved decision making:
• Better-managed data and improved data access make it possible to generate better-quality information, on which better
decisions are based.
• The quality of the information generated depends on the quality of the underlying data.
• Data quality is a comprehensive approach to promoting the accuracy, validity, and timeliness of the data. While the DBMS does
not guarantee data quality, it provides a framework to facilitate data quality initiatives.
• Increased end-user productivity
• The availability of data, combined with the tools that transform data into usable information, empowers end users to make
quick, informed decisions that can make the difference between success and failure in the global economy.
Disadvantage of DBMS

• 1. Increased costs:

• Database systems require sophisticated hardware and software and highly


skilled personnel.
• The cost of maintaining the hardware, software, and personnel required to
operate and manage a database system can be substantial. Training, licensing,
and regulation compliance costs are often overlooked when database systems
are implemented.
• 2. Management complexity:

• Database systems interface with many different technologies and have a


significant impact on a company’s resources and culture.
• The changes introduced by the adoption of a database system must be
properly managed to ensure that they help advance the company’s objectives.
Given the fact that database systems hold crucial company data that are
accessed from multiple sources, security issues must be assessed constantly.
• 3. Maintaining currency:

• To maximize the efficiency of the database system, you must keep your
system current.
• Therefore, you must perform frequent updates and apply the latest patches
and security measures to all components.
• Because database technology advances rapidly, personnel training costs
tend to be significant. Vendor dependence.
• Given the heavy investment in technology and personnel training,
companies might be reluctant to change database vendors.
• 4. Frequent upgrade/replacement cycles:

• DBMS vendors frequently upgrade their products by adding new


functionality. Such new features often come bundled in new upgrade
versions of the software.
• Some of these versions require hardware upgrades. Not only do the
upgrades themselves cost money, but it also costs money to train database
users and administrators to properly use and manage the new features.
Levels of Abstraction
• Physical level describes how a record (e.g., customer) is stored.
• Logicallevel: describes data stored in database, and the
relationships among the data.
type customer = record
name : string;
street : string;
city : integer;
end;
• Viewlevel: application programs hide details of data types. Views
can also hide information (e.g., salary) for security purposes.
View of Data
An architecture for a database system
Instances and Schemas
• Similar to types and variables in programming languages
• Schema – the logical structure of the database
• e.g., the database consists of information about a set of customers and accounts and
the relationship between them)
• Analogous to type information of a variable in a program
• Physical schema: database design at the physical level
• Logical schema: database design at the logical level

• Instance – the actual content of the database at a particular point in time


• Analogous to the value of a variable

• Physical Data Independence – the ability to modify the physical schema


without changing the logical schema
• Applications depend on the logical schema
• In general, the interfaces between the various levels and components should be well
defined so that changes in some parts do not seriously influence others.
Database management systems
architecture
• Database
management systems architecture will help us understand the
components of database system and the relation among them.
• Thearchitecture of DBMS depends on the computer system on which it
runs. For example, in a client-server DBMS architecture, the database
systems at server machine can run several requests made by client
machine. We will understand this communication with the help of
diagrams.
• Types of DBMS Architecture
• There are three types of DBMS architecture:
• 1.Single tier architecture
2. Two tier architecture
3. Three tier architecture
Single tier architecture

• Inthis type of architecture, the database is readily available on the


client machine, any request made by client doesn’t require a
network connection to perform the action on the database.
• Forexample, lets say you want to fetch the records of employee
from the database and the database is available on your computer
system, so the request to fetch employee details will be done by
your computer and the records will be fetched from the database
by your computer as well. This type of system is generally referred
as local database system.
Two tier architecture
• Intwo-tier architecture, the Database system is present at the
server machine and the DBMS application is present at the client
machine, these two machines are connected with each other
through a reliable network as shown in the above diagram.
• Whenever client machine makes a request to access the database
present at server using a query language like sql, the server
perform the request on the database and returns the result back to
the client. The application connection interface such as JDBC,
ODBC are used for the interaction between server and client.
Three tier architecture
• In three-tier architecture, another layer is present between the
client machine and server machine.
• In this architecture, the client application doesn’t communicate
directly with the database systems present at the server machine,
rather the client application communicates with server application
and the server application internally communicates with the
database system present at the server.
Transaction Management
• Transactions are a set of operations used to perform a logical set of work. It is the bundle of all
the instructions of a logical operation. A transaction usually means that the data in the
database has changed. One of the major uses of DBMS is to protect the user’s data from
system failures. It is done by ensuring that all the data is restored to a consistent state when
the computer is restarted after a crash. The transaction is any one execution of the user
program in a DBMS. One of the important properties of the transaction is that it contains a
finite number of steps. Executing the same program multiple times will generate multiple
transactions.
• Example: Consider the following example of transaction operations to be performed to
withdraw cash from an ATM vestibule.
• Steps for ATM Transaction
1. Transaction Start.
2. Insert your ATM card.
3. Select a language for your transaction.
4. Select the Savings Account option.
5. Enter the amount you want to withdraw.
6. Enter your secret pin.
7. Wait for some time for processing.
8. Collect your Cash.
9. Transaction Completed.
A transaction can include the following basic database access
operation.
• Read/Access data (R): Accessing the database item from disk (where
the database stored data) to memory variable.
• Write/Change data (W): Write the data item from the memory
variable to the disk.
• Commit: Commit is a transaction control language that is used to
permanently save the changes done in a transaction
Desirable Properties of Transaction (ACID Properties)
• For a transaction to be performed in DBMS, it must possess several
properties often called ACID properties.
• A – Atomicity
• C – Consistency
• I – Isolation
• D – Durability
Transaction States
 The transaction has four properties. These are used to maintain
consistency in a database, before and after the transaction.
 Property of Transaction:
1. Atomicity
2. Consistency
3. Isolation
4. Durability
1) Atomicity
• States that all operations of the transaction take place at once if not, the
transactions are aborted.
• There is no midway, i.e., the transaction cannot occur partially. Each
transaction is treated as one unit and either run to completion or is not
executed at all.
• Atomicity involves the following two operations:
• Abort: If a transaction aborts, then all the changes made are not visible.
• Commit: If a transaction commits then all the changes made are visible.
2) Consistency
• The integrity constraints are maintained so that the database is consistent before and after the
transaction.
• The execution of a transaction will leave a database in either its prior stable state or anew stable
state.
• The consistent property of database states that every transaction sees a consistent database
instance.
• The transaction is used to transform the database from one consistent state to another consistent
state.
3) Isolation
• It shows that the data which is used at the time of execution of a transaction cannot be used by
the second transaction until the first one is completed.
• In isolation, if the transaction T1 is being executed and using the data item X, then that data item
can’t be accessed by any other transaction T2 until the transaction T1ends.
• The concurrency control subsystem of the DBMS enforced the isolation property
4) Durability
• The durability property is used to indicate the performance of the database’s consistent state. It
states that the transaction made the permanent changes.
• They cannot be lost by the erroneous operation of a faulty transaction or by the system failure.
When a transaction is completed, then the database reaches a state known as the consistent
state. That consistent state cannot be lost, even in the event of a system’s failure.
• The recovery subsystem of the DBMS has the responsibility of Durability property.
CHP-2 DATA
MODEL
Importance of Data
Models
• It has relatively simple representations, usually graphical, of complex
real-world data structures.
• It facilitate interaction among the designer, the applications
programmer, and the end user.
• End-users have different views and needs for data
• Data model organizes data for various user.

24
Basic Building Blocks of Data
Models
• Entity anything about which data are to be
collected
- and stored
Attribute - a characteristic of an entity

• Relationship - describes an association among entities


• One-to-many (1:M) relationship
• Many-to-many (M:N or M:M) relationship
• One-to-one (1:1) relationship
• Constraint - a restriction placed on the data
25
Evaluation of DATA
MODEL

26
1 - Hierarchical Model
• In Hierarchical Model, a hierarchical relation is formed by collection of
relations and forms a tree-like structure.
• The relationship can be defined in the form of parent child type.
• One of the first and most popular Hierarchical Model is Information
Management System (IMS), developed by IBM.
• Example
• The hierarchy shows an Employee can be an Intern, on Contract or Full-
Time. Sub-levels show that Full-Time Employee can be hired as a Writer,
Senior Writer or Editor:

27
 Advantages
• The design of the hierarchical model is simple.
• Provides Data Integrity since it is based on parent/ child relationship
• Data sharing is feasible since the data is stored in a single database.
• Even for large volumes of data, this model works perfectly.

 Disadvantages
• Implementation is complex.
• This model has to deal with anomalies like Insert, Update and Delete.
• Maintenance is difficult since changes done in the database may want you
to do changes in the entire database structure.

28
Network Model
• The Hierarchical Model creates hierarchical tree with parent/ child relationship,
whereas the Network Model has graph and links.

• The relationship can be defined in the form of links and it handles many-to-many
relations. This itself states that a record can have more than one parent.

29
 Advantages:
• Simplicity : The network model is conceptually simple and easy to
design.
• Ability to handle more relationship types : The network model can
handle the one-to-many and many-to-many relationships.
• Ease of data access

 Disadvantages:
• System Complexity : The structure of the network model is very
difficult to change. This type of system is very comple.

30
Relational Model
• In this model, data is organized in two- dimensional tables and the
relationship is maintained by storing a common field.
• This model was introduced by E.F Codd in 1970, and since then it has been
the most widely used database model, infact, we can say the only database
model used around the world.
• The basic structure of data in the relational model is tables. All the
information related to a particular type is stored in rows of that table.
• Hence, tables are also known as relations in relational model.

31
Relational Model

32
Relational
Model
• Relation (file, table) is a two-dimensional table.
• Attribute (i.e. field or data item) is a column in the
table.
• Each column in the table has a unique name within that
table.
• Each column is homogeneous. Thus the entries in any
column are all of the same type (e.g. age, name,
employee-number, etc).
• Each column has a domain, the set of possible values
that can appear in that column.
• A Tuple (i.e. record) is a row in the table.
33
Advantages
• The Relational Model does not have any issues that we saw in the previous
two models i.e. update, insert and delete anomalies have nothing to do in this
model.
• Changes in the database do not require you to affect the complete database.
• Implementation of a Relational Model is easy.
• To maintain a Relational Model is not a tiresome task

Disadvantages
• Database inefficiencies hide and arise when the model has large volumes of
data.
• The overheads of using relational data model come with the cost of using
powerful hardware and devices.
ER (Entity Relationship) Diagram in DBMS

• ER model stands for an Entity-Relationship model. It is a high-level data


model. This model is used to define the data elements and relationship
for a specified system.
• It develops a conceptual design for the database. It also develops a very
simple and easy to design view of data.
• In ER modeling, the database structure is portrayed as a diagram called
an entity-relationship diagram.
• For example, Suppose we design a school database. In this database, the
student will be an entity with attributes like address, name, id, age, etc.
The address can be another entity with attributes like city, street name,
pin code, etc and there will be a relationship between them.
• Component of ER Diagram
1. Entity:
• An entity may be any object, class, person or place. In the ER
diagram, an entity can be represented as rectangles.
• Consideran organization as an example- manager, product,
employee, department etc. can be taken as an entity.

a. Weak Entity
• Anentity that depends on another entity called a weak entity. The
weak entity doesn't contain any key attribute of its own. The weak
entity is represented by a double rectangle.
2. Attribute
• The attribute is used to describe the property of an entity. Eclipse is used
to represent an attribute.
• For example, id, age, contact number, name, etc. can be attributes of a
student.

a. Key Attribute
• The key attribute is used to represent the main characteristics of an
entity. It represents a primary key. The key attribute is represented by an
ellipse with the text underlined.
b. Composite Attribute
• An attribute that composed of many other attributes is known as a
composite attribute. The composite attribute is represented by an
ellipse, and those ellipses are connected with an ellipse.

c. Multivalued Attribute
• Anattribute can have more than one value. These attributes are
known as a multivalued attribute. The double oval is used to
represent multivalued attribute.
• For example, a student can have more than one phone number.
d. Derived Attribute
• Anattribute that can be derived from other attribute is known as a
derived attribute. It can be represented by a dashed ellipse.
• For example, A person's age changes over time and can be
derived from another attribute like Date of birth.
3. Relationship
• A relationship is used to describe the relation between entities. Diamond
or rhombus is used to represent the relationship.

 Types of relationship are as follows:


A. One-to-One Relationship
• When only one instance of an entity is associated with the relationship,
then it is known as one to one relationship.
• For example, A female can marry to one male, and a male can marry to
one female.
b. One-to-many relationship
• When only one instance of the entity on the left, and more than one instance
of an entity on the right associates with the relationship then this is known
as a one-to-many relationship.
• Forexample, Scientist can invent many inventions, but the invention is
done by the only specific scientist.

c. Many-to-one relationship
• When more than one instance of the entity on the left, and only one instance
of an entity on the right associates with the relationship then it is known as a
many-to-one relationship.
• For
example, Student enrolls for only one course, but a course can have
many students.
d. Many-to-many relationship
• When more than one instance of the entity on the left, and more
than one instance of an entity on the right associates with the
relationship then it is known as a many-to-many relationship.
• Forexample, Employee can assign by many projects and project
can have many employees.
SQL Constraints
• SQL constraints are used to specify rules for the data in a table.
• Constraints are used to limit the type of data that can go into a
table. This ensures the accuracy and reliability of the data in the
table. If there is any violation between the constraint and the data
action, the action is aborted.
• Constraintscan be column level or table level. Column level
constraints apply to a column, and table level constraints apply to
the whole table.
• The following constraints are commonly used in SQL:
1. NOT NULL Constraint
• By default, a column can hold NULL values.
• The NOT NULL constraint enforces a column to NOT accept NULL values.
• This enforces a field to always contain a value, which means that you cannot insert a new
record, or update a record without adding a value to this field.
• Example
• CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255) NOT NULL,
Age int
);
• NOT NULL on ALTER TABLE
• ALTER TABLE Persons
ALTER COLUMN Age int NOT NULL;
2. UNIQUE Constraint
• The UNIQUE constraint ensures that all values in a column are different.
• Both the UNIQUE and PRIMARY KEY constraints provide a guarantee for uniqueness
for a column or set of columns.
• A PRIMARY KEY constraint automatically has a UNIQUE constraint.
• However, you can have many UNIQUE constraints per table, but only one PRIMARY
KEY constraint per table.
• CREATE TABLE Persons (
ID int NOT NULL UNIQUE,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int
);
 UNIQUE Constraint on ALTER TABLE
• ALTER TABLE Persons
ADD UNIQUE (ID);
3. PRIMARY KEY Constraint
• The PRIMARY KEY constraint uniquely identifies each record in a table.
• Primary keys must contain UNIQUE values, and cannot contain NULL values.
•A table can have only ONE primary key; and in the table, this primary key can
consist of single or multiple columns (fields).
• CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (ID)
);
PRIMARY KEY on ALTER TABLE
• ALTERTABLE Persons
ADD PRIMARY KEY (ID);
4. FOREIGN KEY Constraint
• The FOREIGN KEY constraint is used to prevent actions that would destroy links
between tables.
• A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the
PRIMARY KEY in another table.
• The table with the foreign key is called the child table, and the table with the primary
PersonID LastName FirstName Age
key is called the referenced or parent table.
1 Hansen Ola 30
• Persons Table
2 Svendson Tove 23
3 Pettersen Kari 20

OrderID OrderNumber PersonID


1 77895 3
• Orders Table
2 44678 3
3 22456 2
4 24562 1
• Notice that the "PersonID" column in the "Orders" table points to the "PersonID"
column in the "Persons" table.
• The "PersonID" column in the "Persons" table is the PRIMARY KEY in the "Persons"
table.
• The "PersonID" column in the "Orders" table is a FOREIGN KEY in the "Orders" table.
• The FOREIGN KEY constraint prevents invalid data from being inserted into the foreign
key column, because it has to be one of the values contained in the parent table.
• FOREIGN KEY on CREATE TABLE
• CREATE TABLE Orders (
OrderID int NOT NULL,
OrderNumber int NOT NULL,
PersonID int,
PRIMARY KEY (OrderID),
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
);
• FOREIGN KEY on ALTER TABLE
• ALTER TABLE Orders
ADD FOREIGN KEY (PersonID) REFERENCES Persons(PersonID);
4.CHECK Constraint
• The CHECK constraint is used to limit the value range that can be placed in a
column.
• Ifyou define a CHECK constraint on a column it will allow only certain values for
this column.
• Ifyou define a CHECK constraint on a table it can limit the values in certain
columns based on values In other columns in the row.
• CHECK on CREATE TABLE
• CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
CHECK (Age>=18)
);
• CHECK on ALTER TABLE
• ALTER TABLE Persons
ADD CHECK (Age>=18);
5. DEFAULT Constraint
• The DEFAULT constraint is used to set a default value for a column.
• The default value will be added to all new records, if no other value is specified.
• CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
City varchar(255) DEFAULT 'Sandnes’
);
DEFAULT on ALTER TABLE
• ALTERTABLE Persons
ALTER City SET DEFAULT 'Sandnes’;
DROP a DEFAULT Constraint
ALTER TABLE Persons
ALTER City DROP DEFAULT;
DDL (Data Definition Language)
• DDL or 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.
1. CREATE
• Create
database or its objects (table, index, function, views, store
procedure, and triggers)
• CREATE TABLE table_name (column1 data_type, column2
data_type, ...);
2. DROP
• Delete objects from the database
3. ALTER
• Alter the structure of the database
• ALTER TABLE table_name ADD COLUMN column_name data_type;
4. TRUNCATE
• Remove all records from a table, including all spaces allocated for
the records are removed
• TRUNCATE TABLE table_name;
5. RENAME
• Rename an object existing in the database
• RENAME TABLE old_table_name TO new_table_name;
DML (Data Manipulation Language)
• TheSQL commands that deal with the manipulation of data
present in the database belong to 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.
1. INSERT
• Insert data into a table
• INSERT INTO table_name (column1, column2, ...) VALUES (value1,
value2, ...);

2. UPDATE
• Update existing data within a table
• UPDATE table_name SET column1 = value1, column2 = value2
3. DELETE
• Delete records from a database table
• DELETE FROM table_name WHERE condition;
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.
1. GRANT
• Assigns new privileges to a user account, allowing access to
specific database objects, actions, or functions.
• GRANT privilege_type [(column_list)] ON [object_type] object_name
TO user [WITH GRANT OPTION];
2. REVOKE
• Removes previously granted privileges from a user account, taking
away their access to certain database objects or actions.
• REVOKE [GRANT OPTION FOR] privilege_type [(column_list)]
ON [object_type] object_name FROM user [CASCADE];
SQL Aggregate Functions

• Anaggregate function is a function that performs a calculation on a set of


values, and returns a single value.
• Aggregatefunctions are often used with the GROUP BY clause of the SELECT
statement. The GROUP BY clause splits the result-set into groups of values
and the aggregate function can be used to return a single value for each
group.
• The most commonly used SQL aggregate functions are:
• MIN() - returns the smallest value within the selected column
• MAX() - returns the largest value within the selected column
• SELECTMIN(column_name)
FROM table_name
WHERE condition;
SELECT MIN(Price)
FROM Products;
• COUNT() - returns the number of rows in a set
• . SELECT COUNT(column_name)
FROM table_name
WHERE condition;

• SELECT COUNT(*)
FROM Products;
• SUM() - returns the total sum of a numerical column
• SELECT SUM(column_name)
FROM table_name
WHERE condition;
• SELECT SUM(Quantity)
FROM OrderDetails;
• AVG() - returns the average value of a numerical column
• SELECT AVG(column_name)
FROM table_name
WHERE condition;
• SELECT AVG(Price)
FROM Products;

You might also like