18 articles MySQL

Advance Store Procedure

Store Procedure Parameters Let’s examine how you can define parameters within a stored procedure. CREATE PROCEDURE procedure_name() : Parameter list is empty CREATE PROCEDURE procedure_name(IN varname DATA-TYPE) : One input parameter. The word IN is optional because parameters are IN (input) by default. CREATE PROCEDURE procedure_name(OUT varname DATA-TYPE) : One output parameter. CREATE PROCEDURE procedure_name(INOUT…

Store Procedure

Store Procedure A stored procedure is a segment of declarative SQL statements stored inside the database catalog. A stored procedure can be invoked by triggers , other stored procedures or applications such as Java, C#, PHP, etc. A stored procedure that calls itself is known as a recursive stored procedure. Most database management system supports…

MySql Date_Format Function

Introduction to MySQL DATE_FORMAT function To format a data value to a specific format, you use the DATE_FORMAT function. The syntax of the DATE_FORMAT function is as follows: DATE_FORMAT(date,format) DATE_FORMAT (date,format) TheDATE_FORMAT function accepts two arguments: date: is a valid date value that you want to format format: is a format string that consists of…

MySql Functions

MySQL aggregate functions an aggregate function performs a calculation on a set of values and returns a single value. MySQL provides many aggregate functions including AVG, COUNT, SUM, MIN , MAX, etc. An aggregate function ignores NULL values when it performs calculation except for the COUNT function. AVG function The AVG function calculates the average…

Top 50 Fresher MYSQL QUERY

Ouery:-add New Colonm into exiting Table. ALTER TABLE emp ADD COLUMN date varchar( 100 ) NULL AFTER salary; Ouery:-Drop a column from exiting Table. ALTER TABLE emp DROP COLUMN date; Ouery:-Renaming table Name of exiting Table Name. ALTER TABLE emp RENAME TO employee Query:- Get all employee details from the employee table SELECT * FROM…

SQL JOIN

SQL INNERJOIN Before using MySQL INNER JOIN clause, you have to specify the following criteria: First, you have to specify the main table that appears in the FROM clause. Second, you need to specify the table that you want to join with the main table, which appears in the INNER JOIN clause. Theoretically, you can…

MySql Truncate Table

MySQL TRUNCATE TABLE The MySQL TRUNCATE TABLE statement allows you to delete all data in a table. Therefore it is like a DELETE statement without a WHERE clause. However in some cases, the MySQL TRUNCATE TABLE statement is more efficient than the DELETE statement. Syntax TRUNCATE TABLE table_name use the TRUNCATE TABLE statement to see…