Print Pattern Examples Using Sql – Query Examples

Print Pattern Examples Using Sql

There are 11 star pattern examples in this tutorial. I will add more example…

In Sql we use replicate function to print pattern easily.

How Replicate Function Works In Sql

The Replicate function get to parameters. The first parameter is the character we want to print and the second parameter is, how many times we want to print the character. Example Select replicate(‘*’,5); The Code prints star character 5 times side by side. Now we can print patterns ;

1. Pattern: Print Left Triangle Example

Result

2. Pattern: Print Right Triangle Example

Result of Code:

3. Pattern: Print Reverse Left Triangle Example

Result

4. Pattern: Print Reverse Right Triangle Example

Result

5. Pattern: Print Pyramid Example

Result of Code

6. Pattern: Print Diamon Example

Result of Code

7. Pattern: Print Twisted Sentence Example

Result of Code

8. Pattern: Print Pyramid Example

Result of Code

9. Pattern: Print Hollow Diamond Example

You can change max value to see different view. But the value must be odd number.

Result of Code

10. Pattern: Print Right Arrow Example

Result of Code

11. Pattern: Print A Word Triangle Example

Result of Code

That’s all for now. I will write new ones soon as possible. I hope you like it.

YOU MAY WANT TO SEE OUR ALL EXAMPLES PAGE, THEN CLICK HERE

About the author

Thomas Brown

4 Comments

Leave a Comment

%d bloggers like this: