Printing a number pattern using SQL Query | Pattern using SQL | Print pattern using SQL | SQL Server

Опубликовано: 01 Январь 1970
на канале: SQL With RaviMartha
715
6

Visit my blog for full script:
https://sqlwithravimartha.blogspot.co...

Palylists:
SQL Interview Questions:
   • Logical Processing of SELECT Statement | L...  
SQL Tutorial Series for Beginners:
   • SQL Overview & Data Storage | Introduction...  
SQL Tips and Tricks:
   • SQL Server Tips and Tricks Part - 1 | Edit...  
SSIS Video Series:
   • SSIS Session | Overview of Data warehouse ...  
SQL In 2 Minutes:
   • SQL in 2 minutes introduction video (SQL w...  


Video 27: Finding Tables with Identity columns - Part 27 | *   • Finding Tables with Identity columns - Par...  
Video 26: Printing Star Patterns using SQL - Part 26 | *   • Printing Star Patterns using SQL - Part 26  
Video 25: Fibonacci Series Using SQL - Part 25 | *   • Fibonacci Series using SQL - V25 - While L...  
Video 24: Splitting data based on format in SQL | *    • Splitting data based on format in SQL| LEA...  
Video 23: Missing Sequence Number in SQL | Recursive CTE | Generate Sequence Number --*    • Missing Sequence Number in SQL |  Recursiv...  
Video 22: Comma Separated values to multiple rows | string_split() , Cross apply --*    • Comma Separated values to multiple rows | ...  
Video 21: XML Path in SQL -    • Comma Separated values in SQL | XML PATH |...  
Video 20: Count and While loop in SQL -    • Count Function in SQL | Count_BIG() | Coun...  
Video 19: Warnings SQL? | Null value is eliminated by an aggregate or other SET operation --*   • Warning in SQL | Null value is eliminated ...  
Video 18: Can we Update a View in SQL? --*   • Can we Update a View in SQL? | SQL Intervi...  
Video 17: Sorting in SQL | Sorting Interview Questions --*   • Sorting in SQL | ORDER BY | Sorting Interv...  
Video 16: Union Vs Union All | With Examples | Prerequisites for Union and Union All | Performance Comparison --*   • Union Vs Union All | With Examples | Prere...  
Video 15: Import data from File to table in SQL Server |.txt, .csv files to table|Import Flat File|Import Data --*   • Import data from File to table in SQL Serv...  
Video 14: Find Employees With Salary Lower Than Their Department Average in SQL --*   • Find Employees Whose Salary Higher Than Th...  
Video 13: Find Employees With Salary Lower Than Their Department Average in SQL --*   • Find Employees With Salary Lower Than Thei...  
Video 12: Import Tables from one Server to another Using SSMS | Import tables using SQL Query in SSMS --*   • Import Tables from one Server to another U...  
Video 11: Table Variables in SQL Server | Pound Tables | Table Variable in SQL | Table Variable in Tempdb --*   • Table Variables in SQL Server | Pound Tabl...  
Video 10: Quick Practical onTemporary tables in SQL Server | Temp Tables in SQL | Local Temp Table | Global Temp Table--*   • Quick Practical on Temporary tables in SQL...  
Video 9: Temporary tables in SQL Server | Temp Tables in SQL | Local Temp Table | Global Temp Table -- *   • Temporary tables in SQL Server | Temp Tabl...  
Video 8: Running total & Avg in SQL | Cumulative Sum & Avg in SQL | Calculating running total & Avg in SQL -- *   • Running total & Avg in SQL | Cumulative Su...  
Video 7 Title: Length Vs DataLength Vs ColumnLength | Len() | DataLength() | Col_Length | Column length in SQL -- *    • Length Vs DataLength Vs ColumnLength | Len...  
Video 6 Title: Tricky CASE Statement Interview Questions | CASE WHEN | WHEN Clause | CASE Statement in SQL -- *    • Tricky CASE Statement Interview Questions ...  
Video 5 Title: Delete Duplicates in SQL by retaining one Unique record | Row Duplicates | Business Key Duplicates -- *    • Delete Duplicates in SQL by retaining one ...  
Video 4 Title: Difference between TRUNCATE, DELETE and DROP -- *    • Difference between TRUNCATE, DELETE and DR...  
Video 3 Title: Sorting in SQL | Order By | Conditional Sorting| Unusual Sorting --*    • Sorting in SQL | Order By | Conditional So...  
Video 2 Title: Difference between Primary Key and Unique Key --*   • Difference between Primary Key and Unique ...  
Video 1 Title: Logical Processing of SELECT Statement -- *   • Logical Processing of SELECT Statement | L...  
SQL Step by Step Video 8 Title: UPDATE | DELETE | WHERE | ALTER | DROP in SQL -- *   • UPDATE | DELETE | WHERE | ALTER | DROP in ...  

Blog: https://sqlwithravimartha.blogspot.com/

Facebook Page:
  / sql-with-ravimartha-109497027391239  
  / etl-dwh-testing-100494175057349  
DECLARE @counter int = 1 -- Declare and Initialize counter
DECLARE @number int = 1 -- Declare and Initialize number to be printed
WHILE @counter Lessthan= 5 -- Condition
BEGIN -- Begin
IF(@number = 1)
BEGIN
PRINT replicate(@number , @counter) -- Print
SET @counter = @counter + 1
IF(@number =1 AND @counter=6) -- once @var value becomes 6 on 5th iteration we increment the number just once
BEGIN
SET @number=@number+1
PRINT replicate(@number , @counter-1)
SET @counter = @counter - 2
END
END
ELSE
BEGIN
PRINT replicate(@number , @counter)
SET @counter = @counter - 1 -- decreasing the counter and using the incremented number from above
IF(@counter=0)
BREAK;
END
END


На этой странице сайта вы можете посмотреть видео онлайн Printing a number pattern using SQL Query | Pattern using SQL | Print pattern using SQL | SQL Server длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь SQL With RaviMartha 01 Январь 1970, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 715 раз и оно понравилось 6 зрителям. Приятного просмотра!