Featured
-
No Featured Found!
Tags
Privileges in MYSQl
Hello Readers,
Hope you are doing good today.
Today on My blog, I am going to explain about the Administrative Privileges in MYSQL.
What is Privileges
Several types of privileges can be granted to an account. Privileges should be...
Brilliant Future is Ahead with Hadoop Technology
Overhauling yourself with the ever challenging and latest technologies resemble securing your future. There are without doubt odds of lacking behind on the off chance that you don't redesign yourself routinely. In industry drive...
Warning : Unknown type 245 sent by the server
Here we will learn how to resolve the error that we come across while updating MySQL 5.5 to MySQL 5.7 on ubuntu 14.04.
After the upgradating, I was trying to login my CakePHP application, but every time I was trying to login I was facing the w...
How to display primary key of a table and database?
Hello friends,
Today we learn how we can display the primary key of a table or database.
1. To display the primary key in a table we can execute any of the following command:
SHOW COLUMNS FROM <database_name>.<table_name> WHE...
How to reset auto increment in mysql?
Hello friends,
Today we will learn how to reset auto-increment in MySQL. Before starting this topic you should know that there can be only one auto column(auto-increment) in a table and it must be defined as a key(primary). There are various way...
Discussion on insert data using replace statement in Mysql
Hi Reader's,
Welcome to FindNerd, today we are going to discuss insert data using replace statement in Mysql
Basically REPLACE INTO Statement is used for inserting a row in a table. If we want to replaces any record form our table then fi...
MySQLi functions to fetch records from resultset: Part-2
Hello friends,
My previous article MySQLi functions to fetch records from resultset demonstrates about mysqli_fetch_row() and mysqli_fetch_array() functions which are used to retrieve data from result sets. This article demonstrates two m...
MySQLi functions to fetch records from resultset.(Part-1)
In previous articles we already learned how to connect MySQL database and how to perform different queries using MySQLi. This article demonstrates some MySQLi functions which are used to retrieve row by row data from resultset. The complete artic...
Count number of rows and fields in a result set using MySQLi functions
In my previous articles we learned how to perform CRUD operation using MySQLi Procedural and Object Oriented style. On performing CRUD operations, the data of MySQL table are affected. This article provides the details of functions which can be u...
How to use LIKE operator in MySQL
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use LIKE operator in MySQL?
Basically, LIKE operator is used for searching for a specified pattern in a column. So in other words we can say that the LIKE operat...
What is process to use Limit clause in MySQL Query ?
Welcome to FindNerd, today we are going to discuss what is process to use Limit clause in MySQL Query.?
Basically the LIMIT clause is used to specify the number of records to return.
In the MySQL LIMIT clause is used to limit the numb...
What are Mysql Indexes
A database index is a structure that improves the speed of retrieval of data from our table. Index is similar to the index of a book. If you want to find a chapter you look in the index first without scanning the whole page. Users cannot see th...
CRUD operations in PHP with MySQLi Object Oriented Interface
My previous article CRUD operations with MySQLi procedural functions is demonstrating about performing CRUD operations on MySQL database. As we know that one of the best feature of MySQLi is that it also provides an object oriented interface, whi...
CRUD operations with MySQLi procedural functions
In previous posts we have learned about creating a connection to a MySQL database with procedural and object oriented way, we also learn how to run a query with mysqli. This article demonstrates how to perform different CRUD operations with MySQL...
MySQLi functions to run a query and checking for errors occcured on last function call
After connecting database successfully, the next important task in an application is performing the query on the connected database. This article provides the details about how we can run a query to a MySQL database using mysqli extension. The ar...
How to check connection errors and change default database in MySQLi
My previous articles titled Connecting MySQL database with MySQLi Object Oriented style and How to connect MySQL database using the MySQLi procedural function demonstrate about different ways to connect to a MySQL database with PHP application. T...
Connecting MySQL database with MySQLi Object Oriented style
My previous article "How to connect MySQL database using MySQLi procedural function" demonstrates the use of MySQLi procedural function mysqli_connect() is used to connect with a MySQL database and MySQLi extension also provides an Obje...
How to connect MySQL database using MySQLi procedural function
Hello friends, my previous article "MySQLi - An improved and enhanced MySQL extension" provides an introduction about the MySQLi extension and its features. This article demonstrates how to create connection with a MySQL database using ...
MySQLi - An improved and enhanced MySQL extension
After depreciation of mysql_* functions from PHP 5.5, MySQLi and PDO are two most popular and preferred options to interact with MySQL databases in PHP. This article demonstrates the introduction of MySQLi and highlights the reasons behind the de...
Use of IN operator and BETWEEN operator in MySQL
MySQl IN operator facilitates us to match a column's value against multiple values in one go.
As most of us are aware that we use WHERE clause for giving any condition in SELECT, INSERT, UPDATE, DELETE statements, so whenever we ...
How to get a list of MySQL user accounts
Get MySQL user accounts
Hello friends, I am using MySQL and I want to list user accounts. So to do this I followed the below process:
This can be done by writing the following query:
SELECT User FROM mysql.user;
...
Database of Countries
Hello friends, I was working on the project where I need to import countries database with their country codes. I am providing you the countries database with the help of which you can display list for countries with their country codes on your w...
How to autogenerate ER Diagrams of database from mysql?
Auto-generate ER Diagrams
Hello friends, I was trying to find a way to create ER Diagram of database. So I was looking for tool through which we can create ER Diagram instead of making flow charts with markers etc. The name of the so...
How to reset AUTO_INCREMENT in MySQL?
Hello friends, I was facing issue in database. I wanted the auto increment should start from 1.
There were 20 rows in table. When I deleted all the rows from the table and inserted new row then auto increment started from id = 21 instead of 1....
Mysql Injections
Hello Readers! this is a small blog on Mysql injection, hope you like it.
Mysql Injection:
MySQL injection is a code injection technique, used to attack data-driven applications, in which harmful SQL statements are inserted into a...
Boolean vs Tinyint vs Bit
Boolean vs Tinyint vs Bit
I was using MySQL to design database, and I need to use boolean datatype where two states are required true or false. I find the following differences among them.
TINYINT is an 8-bit integer value, a BIT ...
IFNULL Function
The IFNULL( ) function is available in MySQL, and not in SQL Server or Oracle. This function takes two arguments.
If the first argument is not NULL, the function returns the first argument. Otherwise, the second argument is...
MySQL: selecting rows where a column is null
In MySQL, we can select rows where a column is null by using IS NULL operator.
We have a table "employee" as below:
employee
id first_name salary country
............................................
What is the use of IFNULL Operator in MySQL?
In MySQL, the IFNULL operator is used as conditional statement for NULL values. When we need to fetch NULL values with LIKE operator then we can use this operator.
Example:
We have a table "employee" as below:
...
How to make WHERE col LIKE '%' select NULL values too?
When we apply LIKE keyword to any query then it doesn't return NULL values, and sometimes it required to return NULL values as well. We can do this by using IS NULL or IFNULL operator.
Example:
We have a table "employee" as be...
How to update multiple row in single mysql query
Hello friends,
Most of time we need to update multiple row at a time or in single mysql query, So most of developer use iterate the update query and execute many time. This is not good practice. We should use syntax given as below.
For Exam...
How to use the mysql result for the sepecific values
Hello Reader's if you are learning, optimizing the mysql query then in this blog you will know some new syntax offered by Mysql where you can make your query fast. Lets see the examples as below:-
In the code below, the results select...
How to install & uninstall MYSQL in ubuntu
Firstly, you need to remove the current MySQL if you are already using:
$ sudo apt-get purge mysql-client-core-5.5
Now, to install MySQL, by running the following commands in terminal:
$ sudo apt-get install mysql-server
$ sudo ap...
Mysql: Compare two columns word and print total common words count
I am posting this blog because I was facing issue to show the total common counts in 3rd column from two columns. This is following table which contain these records:
|==========title=================|======title================|
|...Cat Do...
Query Languages
1. QUEL
It is the query language in the system INGRES. It is based on relational calculus. The fundamental aspect of the query languages based on the relational calculus is tuple variable ( which is a variable that "ranges over&...
Data Definition Language
These statements define the structure of the database. DDL consist of those statements that create,alter and drop database objects and statements that grant and revoke privileges and roles to user of the database.
Statements under this c...
Data Manipulation Language
These statement consist of queries that retrieve data from tables in database and statements that change the data in the database
Statement under this category are:
SELECT
INSERT
UPDATE
DELETE
LOCK TABLE etc.
Insert command
...
Temporary tables
MySQL Temporary tables:
A temporary table allows a user to store temporary records and we can use these records several times until the session does not expire. They are useful in those situations when it is expensive to write a query havin...
Functions in MySQL
Function is a predefined program in which we pass the parameters and it return a value. There are two types of function create function and predefined functions.
Create function- Like other languages we can also create function in MySQL.
Below...
MySQL Stored Procedure
MySQL Stored Procedure
Stored Procedure
1)Stored Procedure are a set of declarative SQL statements which when created are compiled and stored in database.The main reason for their creation is that they are reusable. Stored procedure work d...
SQL commands in database
SQL stands for structured query language. It is used to manage and access data from database.
A database may contain more than one table having unique name for each table.
SQL language have many different versions but it supports most of the co...
Rolling Back A Transaction in MySql
Transactions are very important part of MySql and for handling the transactions the Transaction Control Language (TCL) is used. Transactions are basically used to handle all the changes made in the database.
Rolling back a transaction means stor...
Difference between BLOB AND TEXT in mysql.
A BLOB is a binary large object that can hold a variable amount of data. There are four types of BLOB
TINYBLOB
BLOB
MEDIUMBLOB and
LONGBLOB
They all differ only in the maximum length of the values they can hold.
A...
How change date format using MySql
Hello Reader's if you are using unix timestamp for storing date the time. Then you have to convert them into date format. But now MySql has come with a new syntax of 'format', Because of this it will make the conversion as you want and will save...
How to use top in Mysql
Hello Reader's if you want to use top in your MySql query then this blog is very helfull to you.
Lets see how to use top clause in MySql in different different location.
Suppose if you want to get only first 5 records of the table, Then you c...
How to show table list in a database in MySQL?
Sometimes we need to find table list present in a database so that we can identify which table we have to create and which one not.
To work in a particular database we need to use the below statement first:
use database_name;
Example:
...
How to show CREATE TABLE syntax in MySQL?
Sometimes we need to check the CREATE TABLE syntax for already created table in the database. When we need to check what kind of columns and what datatype a column has in a table then we require the CREATE TABLE syntax for that table.
Syntax
...
How to create a TABLE in MySQL?
To create a table in MySQL, we use the CREATE TABLE statement. A table is a combination of row and columns.
CREATE TABLE Syntax
CREATE TABLE table_name
(
column_name1 data_type(size),
column_name2 data_type(size),
....
);
In the a...
How to create a DATABASE in MySQL?
To create a database in MySQL, we use the CREATE DATABASE statement.
CREATE DATABASE Syntax
CREATE DATABASE database_name;
CREATE DATABASE Example
The below statement will create a database named "demo":
CREATE DATABASE demo;
...
How to use of AND & OR operators in MySQL?
Sometimes we need to filter records based on some conditions, for that we use the AND & OR operators in MySQL.
AND operator - We use AND operator if we require both conditions in a query means the AND operator displays a record only if bot...