• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar

Coder Tutorial

  • Home
  • HTML
  • CSS
  • PHP
  • SQL
  • MySQL
  • JS
  • PL/SQL
  • Python
  • Java
  • Oracle

MySQL

MySQL

MySQL Tutorial is an fast way to learn mysql language with examples for beginners developers.
On this course you can learn about MySQL language using this mysql tutorial based on simple and complex examples.
MySQL language is a widely used relational database management based on SQL language.

The main sections of MySQL language are:

  • Database
  • Data Types
  • Clauses
  • Insert
  • Update
  • Delete
  • Select
  • Flow Control Statements
  • Functions and Operators
  • Table
  • View
  • Temporary Table
  • Triggers
  • Procedure
  • Function
  • Indexes
  • Transactions

Start learn mysql using the basic commands like:

  • How to Create table
  • How to Create procedure
  • How to Create or replace function
  • How to Create trigger
  • How to add primary key in existing table
  • How to add foreign key to existing table
  • How to add a column to an existing table
  • How to add an index to table

Filed Under: MySQL

MySQL Flow Control Statements

MySQL Flow Control Statements

The MySQL Flow Control Statements are:

  • CASE
  • IF
  • ITERATE
  • LEAVE
  • LOOP
  • REPEAT
  • RETURN
  • WHILE

Filed Under: MySQL

MySQL While

MySQL While

MySQL While syntax and example.
The WHILE statement is repeated as long as the condition expression is true.

MySQL While syntax

[ begin_label: ] WHILE condition DO
mysql_code
END WHILE [ end_label ]

While example

CREATE PROCEDURE while_proc(x int)
BEGIN
DECLARE i INT DEFAULT 0;
DECLARE y INT;
SET y = x;
	WHILE y > 0 DO
		IF i=0 THEN 
			SET i = x+1;
		ELSE
			SET i = i+1;
		END IF;	
		SET y = y - 1;
	END WHILE;
	SELECT i;
END;

CALL while_proc(5);

Output

PROCEDURE WHILE_PROC compiled
i
10

Filed Under: MySQL

MySQL Return

MySQL Return

MySQL Return syntax and example.
The RETURN statement terminates execution of a stored function and returns the value expr to the function caller.

Return example

CREATE FUNCTION return_value(x INT)
RETURNS TEXT
BEGIN
	IF x=1 THEN
		RETURN 'OK';
	ELSE
		RETURN 'NOK';
	END IF;
END;

SELECT return_value(1);

Output

FUNCTION RETURN_VALUE compiled
OK

Filed Under: MySQL

MySQL Repeat

MySQL Repeat

MySQL Repeat syntax and example.
The statement list within a REPEAT statement is repeated until the search_condition expression is true.

MySQL Repeat syntax

[ begin_label: ] REPEAT
statement_list
UNTIL search_condition
END REPEAT [ end_label ]

Repeat example

CREATE PROCEDURE repeat_proc(x INT)
BEGIN
DECLARE total INT;
SET total = 0;
	REPEAT
		SET total = total + 1;
		UNTIL total > x 
	END REPEAT;
  SELECT total;
END;

CALL repeat_proc(10);

Output

PROCEDURE REPEAT_PROC compiled
total
11

Filed Under: MySQL

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 10
  • Go to Next Page »

Primary Sidebar

Tutorials

  • HTML Tutorial
  • CSS Tutorial
  • PHP Tutorial
  • SQL Tutorial
  • MySQL Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • PL/SQL Tutorial
  • Java Tutorial
  • SQLPlus Tutorial
  • Oracle Tutorial
  • PostgreSQL Tutorial
  • Ruby Tutorial

Secondary Sidebar

    • MySQL Tutorial
    • Database
    • Data Types
    • Insert
    • Update
    • Delete
    • Select
    • Clauses
    • Where
    • AND
    • OR
    • IN
    • Between
    • Order By
    • Limit
    • Flow Control Statements
    • CASE
    • IF
    • Iterate
    • Leave
    • Loop
    • Repeat
    • Return
    • While
    • Functions and Operators
    • Table
    • View
    • Temporary Table
    • Triggers
    • Procedure
    • Function
    • Indexes
    • Transactions
    • Create trigger
    • Create table
    • Drop table
    • Add column
    • Drop column
    • Rename column
    • Add primary key
    • Add constraint foreign key
    • Drop foreign key
    • Add index
    • Drop index

Copyright  2018 - 2021 Coder Tutorial

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.