MySQL REPEAT Loop Statement in Stored Procedure

Giri Raju
Updated on 22-Jun-2020 06:07:11

938 Views

As we know that MySQL provides us loop statements that allow us to execute a block of SQL code repeatedly based on a condition. A REPEAT loop statement is one of such kind of loop statement. Its syntax is as follows −REPEAT    statements; UNTIL expression END REPEATFirst of all, MySQL executes the statements, and then it evaluates the expression. If the expression evaluates to FALSE, MySQL executes the statements repeatedly until the expression evaluates to TRUE. The REPEAT loop checks the expression after the statements execute, that is why it is also called a post-test loop.To demonstrate the use of a ... Read More

Result of INSERT Function in String Manipulation

Manikanth Mani
Updated on 22-Jun-2020 06:06:02

230 Views

MySQL INSERT() function performs no insertion if the position of insertion is not within the length of the string. There are certain cases like we pass a negative or 0(zero) value or the value goes beyond the value of a total number of characters in an original string by 2 when we can say that ‘pos’ is not within the length of the string. It can be understood with the help of the following example −ExampleThe query below will perform no insertion because the ‘pos’ is not within the length of string i.e. a negative value.mysql> Select INSERT('Tutorialspoint', -1, 4, '.com'); +--------------------------------------+ ... Read More

Style Every p Element That Is the Child of Its Parent with CSS

Chandu yadav
Updated on 22-Jun-2020 06:05:54

219 Views

Use the CSS :nth-last-child(n) selector to style every element that is the child of its parent, counting from the last child. You can try to run the following code to implement the :nth-last-child(n) selectorExampleLive Demo                    p:nth-last-child(4) {             background: blue;             color: white;          }                     This is demo text 1.       This is demo text 2.       This is demo text 3.       This is demo text 4.       This is demo text 5.       This is demo text 6.     Output

In-function INSERT: Result of LEN Not Within Length of String

Ayyan
Updated on 22-Jun-2020 06:05:15

111 Views

In case if ‘len’ is not within the length of the rest of the string then MySQL INSERT() function will continue to remove the characters until the end of the original string.Examplemysql> Select INSERT('myteststring',3,15,'name'); +------------------------------------+ | INSERT('myteststring',3,15,'name') | +------------------------------------+ | myname                             | +------------------------------------+ 1 row in set (0.00 sec)

Insert Substring at Specified Position in MySQL String

Swarali Sree
Updated on 22-Jun-2020 06:04:46

634 Views

We can use a MySQL INSERT() function to insert a substring at the specified position in a string.SyntaxINSERT(original_string, @pos, @len, new_string)Here, original_string is the string in which we want to insert a new string at the place of some specific number of characters.@pos is the position at which the insertion of the new string should start.@len is the number of characters that should delete from the original string. The starting point of the deletion of characters is the value of @pos.New_string is the string we want to insert into the original string.Examplemysql> Select INSERT('MySQL Tutorial', 7, 8, '@Tutorialspoint'); +------------------------------------------------+ | ... Read More

Add Different Styles to Hyperlinks Using CSS

mkotla
Updated on 22-Jun-2020 06:00:28

304 Views

To set different styles to hyperlinks, such as font-size, background color, etc, you can try to run the following code:ExampleLive Demo                    a.first:link {color:#ff0000;}          a.first:visited {color:#0000ff;}          a.first:hover {color:#ffcc00;}          a.second:link {color:#ff0000;}          a.second:visited {color:#0000ff;}          a.second:hover {font-size:150%;}          a.third:link {color:#ff0000;}          a.third:visited {color:#0000ff;}          a.third:hover {background:#66ff66;}                     Mouse over the below given links:       Link changes color       Link changes font-size       Link changes background-color    

Style Last Child

Elements with CSS

George John
Updated on 22-Jun-2020 05:58:52

160 Views

To style every elements that is the last child of its parent, use the CSS :last-child selector. You can try to run the following code to implement the :last-child selectorExampleLive Demo                    p:last-child {             background: orange;          }                     This is demo text1.       This is demo text2.       This is demo text3.     Output

Create MySQL Stored Procedure to Return Multiple Values

Nikitha N
Updated on 22-Jun-2020 05:56:02

2K+ Views

We can create a stored procedure with both IN and OUT parameters to get multiple values from a MySQL table. To make it understand we are taking an example of a table named ‘student_info’ having the following data −mysql> Select * from student_info; +------+---------+------------+------------+ | id   | Name    | Address    | Subject    | +------+---------+------------+------------+ | 101  | YashPal | Amritsar   | History    | | 105  | Gaurav  | Jaipur     | Literature | | 110  | Rahul   | Chandigarh | History    | | 125  | Raman   | Bangalore  | Computers  | ... Read More

Set Min Width and Max Width of an Element using CSS

Ankith Reddy
Updated on 22-Jun-2020 05:55:28

447 Views

To set the minimum and maximum width of an element, you can try to run the following codeExampleLive Demo                    div {             max-width: 300px;             min-width: 100px;             background-color: red;          }                     Below is a div with maximum and minimum width. Resize the web browser to see the effect.       This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text.           Output

Use User Variables in MySQL Stored Procedures

usharani
Updated on 22-Jun-2020 05:54:47

271 Views

In MySQL stored procedure, user variables are referenced with an ampersand i.e. @, prefixed to the user variable names. For example, @A, @B, etc. are user variables. To demonstrate it, we are creating the following procedure −mysql> DELIMITER // ; mysql> CREATE PROCEDURE Proc_Uservariables()    -> BEGIN    -> SET @A = 100;    -> SET @B = 500;    -> SELECT @A,@B,@A+@B;    -> END // Query OK, 0 rows affected (0.00 sec) mysql> Delimiter ; // mysql> CALL Proc_Uservariables(); +------+------+-------+ | @A   | @B   | @A+@B | +------+------+-------+ |  100 |  500 |   600 | +------+------+-------+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.01 sec)

Advertisements