Author: admin
-
MySQL Stored Procedure
Stored Procedure A procedure (often called a stored procedure) is a subroutine like a subprogram in a regular computing language, stored in database. A procedure has a name, a parameter list, and SQL statement(s). All most all relational database system supports stored procedure, MySQL 5 introduce stored procedure. In the following sections we have discussed…
-
MySQL Subqueries
Subqueries A subquery is a SQL query nested inside a larger query. Contents: MySQL Subqueries with EXISTS or NOT EXISTS MySQL Correlated Subqueries MySQL Subqueries in the FROM Clause Subquery Syntax: Subquery syntax as specified by the SQL standard and supported in MySQLDELETE FROM t1 WHERE s11 > ANY (SELECT COUNT(*) /* no hint */…
-
MySQL JOINS
Understanding JOINs in MySQL A join enables you to retrieve records from two (or more) logically related tables in a single result set. JOIN clauses are used to return the rows of two or more queries using two or more tables that shares a meaningful relationship based on a common set of values. These values…
-
Find duplicate data in MySQL
Objective There are many occasions when you need to find duplicate values available in a column of a MySql table. Often, you may want to count the number of duplicate values in a MySQL table. In this article, we have discussed a query where you can find duplicates, triplicates, quadruplicates (or more) data from a MySQL…
-
MySQL FUNCTIONS and OPERATORS
FUNCTIONS and OPERATORS In the following section, we have given a list of FUNCTIONS and OPERATORS in MySQL as anyone can view the FUNCTIONS at a glance and jump immediately to his/her requirement. MySQL Function & Operators Description Introduction of MySQL functions and operators Types of MySQL functions and operators. MySQL Comparison Functions and Operators…
-
MySQL aggregate functions and grouping
aggregate functions MySQL aggregate functions retrieve a single value after performing a calculation on a set of values. In general, aggregate functions ignore null values. Often, aggregate functions are accompanied by the GROUP BY clause of the SELECT statement. List of MySQL aggregate functions and a hint of what they do AVG() MySQL AVG() retrieves…
-
MySQL UNION
UNION In MySQL, the UNION operator is used to combine the result from multiple SELECT statements into a single result set. The default characteristic of UNION is, to remove the duplicate rows from the result. The DISTINCT keyword which is optional does not make any effect, because, by default, it specifies duplicate-row removal. But if…
-
MySQL SELECT statement
SELECT statement MySQL SELECT statement is used to retrieve rows from one or more tables. The statement can also include UNION statements and subqueries. Syntax:SELECT [ALL | DISTINCT | DISTINCTROW ] [HIGH_PRIORITY] [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] select_expr [, select_expr …] [FROM table_references [WHERE where_condition] [GROUP BY {col_name | expr | position} [ASC…
-
MySQL DELETE statement
DELETE statement DELETE statement is used to remove rows from a table. Version: MySQL 5.6 Single-table syntax:DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM table_name [PARTITION (partition_name,…)] [WHERE where_condition] [ORDER BY …] [LIMIT row_count] Explanation: Multiple-table syntax :DELETE [LOW_PRIORITY] [QUICK] [IGNORE] tbl_name[.*] [, tbl_name[.*]] … FROM table_references [WHERE where_condition] Or :DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name[.*] [, tbl_name[.*]] ……
-
MySQL UPDATE Statement
UPDATE Table The MySQL UPDATE statement is used to update columns of existing rows in a table with new values. Version: 5.6 Syntax : Single table:UPDATE [LOW_PRIORITY] [IGNORE] table_reference SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] … [WHERE where_condition] [ORDER BY …] [LIMIT row_count] Multiple tables:UPDATE [LOW_PRIORITY] [IGNORE] table_references SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] … [WHERE where_condition] Arguments Name…