SlideShare a Scribd company logo
MySQL Training
By Manish Mittal
OpenSource Technologies Pvt. Ltd.
http://www.opensourcetechnologies.com
Types of Joins
• CROSS JOIN:-This type of join is the simplest join. The cross join result in
cartesian product of all the records from two tables.
select * from employee cross join department
• INNER JOIN OR EQUI JOIN:-This is the type of join where tables are
combined based on a common column.
select * from employee , department where employee .deptid=
department.depid;
• OUTER JOIN:- Join is used to combine all rows of one table with matching
rows from the other table and also show unmatchable records from other
table. It is used whenever multiple tables must be accessed through a SQL
SELECT statement
SELECT * FROM roseindia AS R
-> LEFT JOIN newstrack AS N
-> ON R.EmpId = N.EmpId
http://www.opensourcetechnologies.com
Triggers
• A trigger is a named database object that is
associated with a table, and that activates
when a particular event occurs for the table.
Some uses for triggers are to perform checks
of values to be inserted into a table or to
perform calculations on values involved in an
update.
http://www.opensourcetechnologies.com
Trigger Example
• CREATE TRIGGER ins_sum BEFORE INSERT ON
account -> FOR EACH ROW SET @sum = @sum
+ NEW.amount;
• create trigger bi_emps_fer before insert on
emps for each row begin insert into audit
(user_name, table_name, update_date)
values (current_user(),’emps’,now()); end; //
http://www.opensourcetechnologies.com
Procedure Example
• delimiter //
• CREATE PROCEDURE simpleproc (OUT
param1 INT) -> BEGIN -> SELECT COUNT(*)
INTO param1 FROM t; ->
• END//
• delimiter ;
• CALL simpleproc(@a);
http://www.opensourcetechnologies.com
Function Example
• CREATE FUNCTION hello (s CHAR(20))
RETURNS CHAR(50) DETERMINISTIC ->
RETURN CONCAT('Hello, ',s,'!');
• SELECT hello('world');
http://www.opensourcetechnologies.com
S.Pro Vs functions
• There is one main difference between functions and
procedures.
A function must return a value and it can be only a
single value. Any number of parameters can be passed
in but only 1 value can be passed out. This value
coming out must be done via the RETURN.
A Procedure doesn't have to return anything. But it can
accept any number of parameters in and also any
number of parameters out. There is no RETURN in a
procedure.
http://www.opensourcetechnologies.com
Transaction
• The START TRANSACTION or BEGIN statement
begins a new transaction. COMMIT commits
the current transaction, making its changes
permanent. ROLLBACK rolls back the current
transaction, canceling its changes. The SET
autocommit statement disables or enables the
default autocommit mode for the current
session.
http://www.opensourcetechnologies.com
Save points
• SAVEPOINT identifier
• ROLLBACK TO [SAVEPOINT] identifier
• RELEASE SAVEPOINT identifier
http://www.opensourcetechnologies.com
Cursors
• Cursor can be created inside the stored
procedures, functions and triggers. Cursors
are used for rows iteration returned by a
query on a row-by-row basis. It is different
from typical SQL commands that operate on
all the rows in the set returned by a query at
one time.
http://www.opensourcetechnologies.com
Ad

More Related Content

What's hot (20)

Operators in java
Operators in javaOperators in java
Operators in java
yugandhar vadlamudi
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
Raveena Thakur
 
Operators in C & C++ Language
Operators in C & C++ LanguageOperators in C & C++ Language
Operators in C & C++ Language
PreSolutions Softwares
 
Bai giang-uml-25-27feb14
Bai giang-uml-25-27feb14Bai giang-uml-25-27feb14
Bai giang-uml-25-27feb14
TRAN Khanh Dung, Khoa CNTT, Đại Học Xây Dựng
 
Conditional operators
Conditional operatorsConditional operators
Conditional operators
BU
 
OCA JAVA - 3 Programming with Java Operators
 OCA JAVA - 3 Programming with Java Operators OCA JAVA - 3 Programming with Java Operators
OCA JAVA - 3 Programming with Java Operators
Fernando Gil
 
Sql FUNCTIONS
Sql FUNCTIONSSql FUNCTIONS
Sql FUNCTIONS
Abrar ali
 
Stacks in Data Structure
Stacks in Data StructureStacks in Data Structure
Stacks in Data Structure
Lovely Professional University
 
Function
FunctionFunction
Function
Durgaprasad Yadav
 
Anonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLABAnonymous and Inline Functions in MATLAB
Anonymous and Inline Functions in MATLAB
Shameer Ahmed Koya
 
Mobx - performance and sanity
Mobx - performance and sanityMobx - performance and sanity
Mobx - performance and sanity
500Tech
 
Relational operators In C language (By: Shujaat Abbas)
Relational operators In C language (By: Shujaat Abbas)Relational operators In C language (By: Shujaat Abbas)
Relational operators In C language (By: Shujaat Abbas)
Shujaat Abbas
 
Stacks in DATA STRUCTURE
Stacks in DATA STRUCTUREStacks in DATA STRUCTURE
Stacks in DATA STRUCTURE
Mandeep Singh
 
itft-Operators in java
itft-Operators in javaitft-Operators in java
itft-Operators in java
Atul Sehdev
 
Mobx Performance and Sanity
Mobx Performance and SanityMobx Performance and Sanity
Mobx Performance and Sanity
500Tech
 
Adding Random Operations to OCL
Adding Random Operations to OCLAdding Random Operations to OCL
Adding Random Operations to OCL
Antonio Vallecillo
 
Odersky week1 notes
Odersky week1 notesOdersky week1 notes
Odersky week1 notes
Doug Chang
 
Dictionary and sets-converted
Dictionary and sets-convertedDictionary and sets-converted
Dictionary and sets-converted
Micheal Ogundero
 
Relational operators
Relational operatorsRelational operators
Relational operators
Graphic Era Hill University,Bhimtal
 
Quiz2 cs141-1-17
Quiz2 cs141-1-17Quiz2 cs141-1-17
Quiz2 cs141-1-17
Fahadaio
 

Similar to MySQL Training (20)

Triggers n Cursors.ppt
Triggers n Cursors.pptTriggers n Cursors.ppt
Triggers n Cursors.ppt
VADAPALLYPRAVEENKUMA1
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
Carlos Oliveira
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
poornima sugumaran
 
Oracle Course
Oracle CourseOracle Course
Oracle Course
rspaike
 
Crime record management system project.pptx
Crime record management system project.pptxCrime record management system project.pptx
Crime record management system project.pptx
shindegls59
 
Operators loops conditional and statements
Operators loops conditional and statementsOperators loops conditional and statements
Operators loops conditional and statements
Vladislav Hadzhiyski
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
poornima sugumaran
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
paulguerin
 
IR SQLite Session #1
IR SQLite Session #1IR SQLite Session #1
IR SQLite Session #1
InfoRepos Technologies
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in Swift
Saugat Gautam
 
Aggregate functions in SQL.pptx
Aggregate functions in SQL.pptxAggregate functions in SQL.pptx
Aggregate functions in SQL.pptx
SherinRappai1
 
MySQL Query And Index Tuning
MySQL Query And Index TuningMySQL Query And Index Tuning
MySQL Query And Index Tuning
Manikanda kumar
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
Peter Elst
 
Integrity constraint fundamentals of dbms.pdf
Integrity constraint fundamentals of dbms.pdfIntegrity constraint fundamentals of dbms.pdf
Integrity constraint fundamentals of dbms.pdf
Saikrishna492522
 
Mssql
MssqlMssql
Mssql
Janas Khan
 
ORACLE PL SQL FOR BEGINNERS
ORACLE PL SQL FOR BEGINNERSORACLE PL SQL FOR BEGINNERS
ORACLE PL SQL FOR BEGINNERS
mohdoracle
 
Aggregate functions in SQL.pptx
Aggregate functions in SQL.pptxAggregate functions in SQL.pptx
Aggregate functions in SQL.pptx
SherinRappai
 
SQL Views
SQL ViewsSQL Views
SQL Views
baabtra.com - No. 1 supplier of quality freshers
 
Multimedia Databases Concepts: Managing images, video, audio and beyond
Multimedia Databases Concepts: Managing images, video, audio and beyondMultimedia Databases Concepts: Managing images, video, audio and beyond
Multimedia Databases Concepts: Managing images, video, audio and beyond
COSMOS58
 
Introduction to mysql part 3
Introduction to mysql part 3Introduction to mysql part 3
Introduction to mysql part 3
baabtra.com - No. 1 supplier of quality freshers
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
Carlos Oliveira
 
Oracle Course
Oracle CourseOracle Course
Oracle Course
rspaike
 
Crime record management system project.pptx
Crime record management system project.pptxCrime record management system project.pptx
Crime record management system project.pptx
shindegls59
 
Operators loops conditional and statements
Operators loops conditional and statementsOperators loops conditional and statements
Operators loops conditional and statements
Vladislav Hadzhiyski
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
paulguerin
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in Swift
Saugat Gautam
 
Aggregate functions in SQL.pptx
Aggregate functions in SQL.pptxAggregate functions in SQL.pptx
Aggregate functions in SQL.pptx
SherinRappai1
 
MySQL Query And Index Tuning
MySQL Query And Index TuningMySQL Query And Index Tuning
MySQL Query And Index Tuning
Manikanda kumar
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
Peter Elst
 
Integrity constraint fundamentals of dbms.pdf
Integrity constraint fundamentals of dbms.pdfIntegrity constraint fundamentals of dbms.pdf
Integrity constraint fundamentals of dbms.pdf
Saikrishna492522
 
ORACLE PL SQL FOR BEGINNERS
ORACLE PL SQL FOR BEGINNERSORACLE PL SQL FOR BEGINNERS
ORACLE PL SQL FOR BEGINNERS
mohdoracle
 
Aggregate functions in SQL.pptx
Aggregate functions in SQL.pptxAggregate functions in SQL.pptx
Aggregate functions in SQL.pptx
SherinRappai
 
Multimedia Databases Concepts: Managing images, video, audio and beyond
Multimedia Databases Concepts: Managing images, video, audio and beyondMultimedia Databases Concepts: Managing images, video, audio and beyond
Multimedia Databases Concepts: Managing images, video, audio and beyond
COSMOS58
 
Ad

More from OpenSource Technologies Pvt. Ltd. (13)

OpenSource Technologies Portfolio
OpenSource Technologies PortfolioOpenSource Technologies Portfolio
OpenSource Technologies Portfolio
OpenSource Technologies Pvt. Ltd.
 
Cloud Computing Amazon
Cloud Computing AmazonCloud Computing Amazon
Cloud Computing Amazon
OpenSource Technologies Pvt. Ltd.
 
Empower your business with joomla
Empower your business with joomlaEmpower your business with joomla
Empower your business with joomla
OpenSource Technologies Pvt. Ltd.
 
Responsive Web Design Fundamentals
Responsive Web Design FundamentalsResponsive Web Design Fundamentals
Responsive Web Design Fundamentals
OpenSource Technologies Pvt. Ltd.
 
PHP Shield - The PHP Encoder
PHP Shield - The PHP EncoderPHP Shield - The PHP Encoder
PHP Shield - The PHP Encoder
OpenSource Technologies Pvt. Ltd.
 
Zend Framework
Zend FrameworkZend Framework
Zend Framework
OpenSource Technologies Pvt. Ltd.
 
Introduction to Ubantu
Introduction to UbantuIntroduction to Ubantu
Introduction to Ubantu
OpenSource Technologies Pvt. Ltd.
 
WordPress Plugins
WordPress PluginsWordPress Plugins
WordPress Plugins
OpenSource Technologies Pvt. Ltd.
 
WordPress Complete Tutorial
WordPress Complete TutorialWordPress Complete Tutorial
WordPress Complete Tutorial
OpenSource Technologies Pvt. Ltd.
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
OpenSource Technologies Pvt. Ltd.
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
OpenSource Technologies Pvt. Ltd.
 
Asp.net
Asp.netAsp.net
Asp.net
OpenSource Technologies Pvt. Ltd.
 
OST Profile
OST ProfileOST Profile
OST Profile
OpenSource Technologies Pvt. Ltd.
 
Ad

Recently uploaded (20)

Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 

MySQL Training

  • 1. MySQL Training By Manish Mittal OpenSource Technologies Pvt. Ltd. http://www.opensourcetechnologies.com
  • 2. Types of Joins • CROSS JOIN:-This type of join is the simplest join. The cross join result in cartesian product of all the records from two tables. select * from employee cross join department • INNER JOIN OR EQUI JOIN:-This is the type of join where tables are combined based on a common column. select * from employee , department where employee .deptid= department.depid; • OUTER JOIN:- Join is used to combine all rows of one table with matching rows from the other table and also show unmatchable records from other table. It is used whenever multiple tables must be accessed through a SQL SELECT statement SELECT * FROM roseindia AS R -> LEFT JOIN newstrack AS N -> ON R.EmpId = N.EmpId http://www.opensourcetechnologies.com
  • 3. Triggers • A trigger is a named database object that is associated with a table, and that activates when a particular event occurs for the table. Some uses for triggers are to perform checks of values to be inserted into a table or to perform calculations on values involved in an update. http://www.opensourcetechnologies.com
  • 4. Trigger Example • CREATE TRIGGER ins_sum BEFORE INSERT ON account -> FOR EACH ROW SET @sum = @sum + NEW.amount; • create trigger bi_emps_fer before insert on emps for each row begin insert into audit (user_name, table_name, update_date) values (current_user(),’emps’,now()); end; // http://www.opensourcetechnologies.com
  • 5. Procedure Example • delimiter // • CREATE PROCEDURE simpleproc (OUT param1 INT) -> BEGIN -> SELECT COUNT(*) INTO param1 FROM t; -> • END// • delimiter ; • CALL simpleproc(@a); http://www.opensourcetechnologies.com
  • 6. Function Example • CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50) DETERMINISTIC -> RETURN CONCAT('Hello, ',s,'!'); • SELECT hello('world'); http://www.opensourcetechnologies.com
  • 7. S.Pro Vs functions • There is one main difference between functions and procedures. A function must return a value and it can be only a single value. Any number of parameters can be passed in but only 1 value can be passed out. This value coming out must be done via the RETURN. A Procedure doesn't have to return anything. But it can accept any number of parameters in and also any number of parameters out. There is no RETURN in a procedure. http://www.opensourcetechnologies.com
  • 8. Transaction • The START TRANSACTION or BEGIN statement begins a new transaction. COMMIT commits the current transaction, making its changes permanent. ROLLBACK rolls back the current transaction, canceling its changes. The SET autocommit statement disables or enables the default autocommit mode for the current session. http://www.opensourcetechnologies.com
  • 9. Save points • SAVEPOINT identifier • ROLLBACK TO [SAVEPOINT] identifier • RELEASE SAVEPOINT identifier http://www.opensourcetechnologies.com
  • 10. Cursors • Cursor can be created inside the stored procedures, functions and triggers. Cursors are used for rows iteration returned by a query on a row-by-row basis. It is different from typical SQL commands that operate on all the rows in the set returned by a query at one time. http://www.opensourcetechnologies.com