SQL Tutorial 17- Create, Alter and Drop Procedure

Published: 06 March 2023
on channel: Learn Microsoft Fabric, Power BI, SQL Amit Chandak
338
11

Learn SQL, How to use Create, Alter, and Drop Procedures. #sql, #rdbms, #table, #amitchandakda #interviewquestions #interview #index

SQL Tutorial 17- Create, Alter and Drop Procedure


Definition Source: Google Search, Wikipedia, IBM, W3School, ChatGPT

00:00 Introduction
00:30 What is a Procedure
02:30 Create Procedure
08:00 Debug Procedure
12:00 Alter Procedure
15:45 Drop Procedure

SQL Tutorial 16- Window Functions- Lead, Lag, First_value, Last_value using over and Partition By


create procedure select_sales
as
Begin
select * from sales;
end;

exec select_sales

create procedure select_sales1 @item int
as
Begin
select * from sales where item_id = @item;
end;

exec select_sales1 11

create procedure select_sales2 @brand varchar , @category varchar
as
Begin
select * from sales s
inner join item i on (s.Item_ID = i.Item_Id)
where i.brand = @brand and i.Category = @category;
end;

alter procedure select_sales2 @brand varchar , @category varchar
as
Begin
select * from sales s
inner join item i on (s.Item_ID = i.Item_Id)
where i.brand = @brand and i.Category = @category;
end;

exec select_sales2 'Brand 1' , 'Category 1'

select * from sales s
inner join item i on (s.Item_ID = i.Item_Id)
where i.brand = 'Brand 1' and i.Category = 'Category 1';

alter procedure select_sales2 @brand varchar , @category varchar
as
Begin
select * from sales s
inner join item i on (s.Item_ID = i.Item_Id)
where i.brand = 'Brand 1' ;
end;

exec select_sales2 'Brand 1' , 'Category 1'


alter procedure select_sales2 @brand varchar , @category varchar
as
Begin
select * from sales s
inner join item i on (s.Item_ID = i.Item_Id)
where i.brand = @brand ;
end;

alter procedure select_sales2 @brand varchar(50) , @category varchar(50)
as
Begin
select * from sales s
inner join item i on (s.Item_ID = i.Item_Id)
where i.brand = @brand and i.Category = @category;
end;

exec select_sales2 'Brand 1' , 'Category 1'

drop procedure select_sales2


exec select_sales2 'Brand 1' , 'Category 1'

~-~~-~~~-~~-~
Please watch: "Microsoft Power BI Tutorial For Beginners✨ | Power BI Full Course 2023 | Learn Power BI"
   • Microsoft Power BI Tutorial For Beginners✨...  
~-~~-~~~-~~-~


On this page of the site you can watch the video online SQL Tutorial 17- Create, Alter and Drop Procedure with a duration of hours minute second in good quality, which was uploaded by the user Learn Microsoft Fabric, Power BI, SQL Amit Chandak 06 March 2023, share the link with friends and acquaintances, this video has already been watched 338 times on youtube and it was liked by 11 viewers. Enjoy your viewing!