0% found this document useful (0 votes)
90 views12 pages

Group 1 Index MySQL PPT @

Uploaded by

Num G
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)
90 views12 pages

Group 1 Index MySQL PPT @

Uploaded by

Num G
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/ 12

Group 1

Index, View, TCL Commands


Definition: An index is a data structure that improves the
speed of data retrieval operations on a database table at the
cost of additional storage space.

Index in SQL Purpose:


Faster Query Performance: Helps in quick
Efficient Sorting and Filtering: Improves
sorting and filtering operations
searching and fetching of data.
in SQL queries.

Analogy:
Think of an index like a book's index that allows you to
find a topic quickly without reading the whole book.
View in SQL

Example:
Definition : Syntax:

• view is a virtual table based • CREATE VIEW view_name • CREATE VIEW


on the result- set of an AS sales_employees as SELECT
SQL query. It contains rows • SELECT column1, employee_id, first_name,
and columns, just like a real column2, ... last_name, department
table, but it does not store • FROM table_name • FROM employees
the data itself. Instead, it • WHERE condition; . • WHERE department =
provides a way to 'Sales';
simplify complex queries,
reuse code, and secure
sensitive data by controlling
access.
• Modifying a View :You can modify an existing view
using the ALTER VIEW Statement
Syntax:
ALTER VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
View in SQL WHERE condition;.
• Dropping a View: To remove the view using DROP
VIEW Statement
Syntax:
DROP VIEW view_name;
• Updatable View :Some views in MySQL can be
updatable , we can use INSERT ,UPDATE OR
DELETE
View in SQL

•Definition : View is a virtual table based on the result-set of an


SQL query. It contains rows and columns, just like a
real table, but it does not store the data itself.
Instead, it provides a way to simplify complex queries, reuse
code, and secure sensitive data by controlling access.
•Syntax:
CREATE VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
WHERE condition; .
Eg:
CREATE VIEW sales_employees AS
SELECT employee_id, first_name, last_name,
department
FROM employees
WHERE department = 'Sales';
• TCL stands for Transaction control
language
• A single unit of work in a database
is formed after the consecutive
execution of commands is known
as transaction.
TCL COMMANDS IN • There are certain commands
present in SQL known as TCL
MySQL commands that help the user
manage the user manage the
transaction that take place in a
database.
Commit, Rollback
And SavePoint are
the most commonly
used TCL commands
in SQL
1. COMMIT : It is
used to save the
transaction on
the database
2.ROLLBACK: Undoes
the changes made
during the current
transaction if
something goes
wrong or if changes
need to be discarded
3.SAVEPOINT: Sets of
a point within a
transaction to which
you can later roll
back, allowing partial
undo of the
transaction
THANK YOU
Submitted by:
Sumanth Reddy
Lohith Reddy

You might also like