Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Transaction in SQL

A transaction is used to check whether all SQL statements get executed successfully or not. A Single transaction starts with a particular statement and ends after the completion of all the SQL statements executed successfully. If all SQL statemen...

Locking techniques in Concurrency control in SQL

Concurrency Control when multiple users accessing a same database at the same time, If any change made by any one of the user do not adversely affect work of the other users. Locking technique in concurrency control means use a lock variable wi...

Full Calendar Events From Database

1- Create a mysql Database.   2- Create a Table events inside created database.    CREATE TABLE `events` ( `id` int(10) NOT NULL AUTO_INCREMENT, ...

How to get selected numbers of character from column using Codeigniter?

Hello Readers, If you are using CodeIgniter you want to fetch limited MySQL results then in this blog we will learn how to to this.   Suppose you want only first 200 chars of a field then you should only fetch limited results, this wil...

MySql: Display last conversation between multiple users in Inbox

Retrieve last message between multiple users and display it in inbox   Hello friends today I am going to tell you how to display last conversation in Inbox. For example: In whatsapp chat list we can see the last conversation of each us...

Import excel sheet into database using PHP

Hello friends, This tutorial will help you to insert excel sheet data into the MySQL database using PHP I have also included the snapshots which will help you to understand more clearly.   Import Students: You can import students by cl...

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 ...

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 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....

How to use SQL Min () Function ?

Hi Reader's,   Welcome to FindNerd, today we are going to discuss how to use   SQL Min () Function in Sql. SQL Min () Function is used for getting the minimum value from the selected field. Syntax of SQL Min (): se...

MySQL CONCAT Functions

CONCAT function is mysql plays a vital role. The CONCAT() function combine or concatenate the list of strings together . We have 2 types of concat function -> CONCAT() – This function will concate list of string together without...

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 ............................................

How to install MySQL on Ubuntu 14.04

How to Install MySQL on Ubuntu: Step 1 - Installing MySQL To install MySQL you need to update the package index on your server and then install the package with apt-get. Write the following commands to install MySQL $ sudo apt-get u...

How to insert values into database in php.

Inserting data to a database would be possible by using SQL statements, specifically the INSERT command. Data can be entered  into the database using insert query into the function, here is simple line of code that will create a database usi...

How to use Left Join

Left Join: Left Join is used to join two tables and it return all rows from table 1 and matching rows from table 2. The result is NULL for unmatched rows for table 2. Left Join keyword is used to apply Left Join on two tables. Syntax for Le...

Truncating a table

TRUNCATE TABLE Statement: TRUNCATE Statement is used to remove all records from a table. It is a Data Definition Language (DDL) Statement as it deletes all records and only structure remains. It is similar to delete statement but without where...

Null Values

Null Values: Null values denotes missing data in a table or a database. If a column does not have any NOT NULL constraint then for that column there can be NULL values. By default a column can have NULL values. We cannot use comparison oper...

Combining Results of two or more SELECT Statements

Combining Results of two or SELECT Statements using UNION OPERATOR: UNION Operator is used to combine the results of two or more SELECT statements. But UNION operator does not return duplicate rows so to return duplicate rows UNION ALL operato...

Sub Queries

Sub Queries: Sub Queries are those query which comes within another query and are written after the WHERE clause.They are also known as Inner query or nested query. It is used to return records that are used in the main query as a conditio...

DELETE Query

DELETE Statement: It is used to delete existing records from a table. It can delete all records from a table if where condition is not given and if where condition is given than it will delete selected records which will meet the condition. ...

Group By Statement

Group By : It is used to group the result-set by one or more column. It is used in conjunction with aggregate functions provided by Structured Query Language . If order by is used then Group By must come before Order By clause. Syntax1: ...

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...

What is the use of LIMIT Clause in MySQL?

In MySQL, the LIMIT Clause is used to return the specified number of records means by using LIMIT we can specify how many records we want to return from a table.. The LIMIT Clause is useful when, we want to select some records from a table whi...

How to get the last record from a table in MySQL?

Sometimes we need to find the last inserted record into table. We can do this by using ORDER by and LIMIT. Syntax: SELECT * FROM table_name ORDER by id DESC LIMIT 1; Example: Suppose we have a table named "tickit" and we want to fi...

What is the use of Aliases in MySQL?

In MySQL, aliases are used to give temporarily name to a table or a column. When we write a query we use Aliases to make column name more readable. Alias Syntax for Columns SELECT column_name AS alias_name FROM table_name; Alias Synta...

What is the use of LIKE Operator in MySQL?

In MySQL, the LIKE operator is used to search for a specified pattern for a column in a WHERE clause . LIKE Syntax SELECT column_name FROM table_name WHERE column_name LIKE pattern; We have a table "employee" as below: employe...

What is the use of UPDATE statement in MySQL?

In MySQL, the UPDATE statement is used to update existing records in a table. UPDATE Syntax UPDATE table_name SET column1=value1,column2=value2,... WHERE some_column=some_value; In the above syntax, WHERE clause specifies which row o...

What is the use of IN Operator in MySQL?

In MySQL, the IN operator is used to allow us specify multiple values in a WHERE clause. IN Operator Syntax SELECT column_name FROM table_name WHERE column_name IN (value1,value2,...); We have a table "employee" as below: empl...

What is the use of BETWEEN Operator in MySQL?

In MySQL, the BETWEEN operator is used to select values (values can be numbers, text, or dates) from a column within a specified range. BETWEEN Syntax SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2; ...

What is the use of ORDER by Keyword in MySQL.

In MySQL, the ORDER by keyword is used to get records from a table in sorted order. The ORDER BY keyword can use one or more columns to sort the result-set. We can sort the records in both ascending and descending order.By default, ORDER by ke...

What is the use of WHERE Clause in MySQL?

In MySQL, the WHERE clause is used to filter records from a table. The WHERE clause is used to get the records that match the specified criteria in that. WHERE Clause Syntax SELECT column_name,column_name FROM table_name WHERE column_name...

Use of SELECT statement in MySQL.

In MySQL, The SELECT statement is used to select data from a table. SELECT Syntax SELECT column_name,column_name FROM table_name; and to select all records SELECT * FROM table_name; We have a table "employee" as below: ...

What is the use of GROUP by statement in MySQL?

The GROUP by statement is used with the aggregate functions to group the result by one or more columns. GROUP by Syntax SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value GROUP by column_...

What is the use of HAVING Clause in MySQL?

The HAVING clause is used with aggregate functions as the WHERE clause can not be used with them. HAVING Syntax SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value GROUP BY column_name HA...

what is the use of FORMAT() function in SQL?

In SQL, FORMAT() function is used to format a column value means how a field will to be displayed. FORMAT() Syntax SELECT FORMAT(column_name,format) FROM table_name; In the above syntax parameters are as below: Parameter Descri...

what is the use of NOW() function in SQL?

In SQL, NOW() function is used to return the current system date and time. NOW() Syntax SELECT NOW() FROM table_name; We have a table "employee" as below: employee id first_name last_name salary ........

what is the use of LEN() function in MySQL?

In MySQL, LEN() function is used to return the length of the value in a column (text field) in a table. LEN() Syntax SELECT LEN(column_name) FROM table_name; We have a table "employee" as below: employee id first_name ...

How to use SUM() function in MySQL?

In MySQL, SUM() function is used to return the total sum of a numeric column in a table. SUM() Syntax SELECT SUM(column_name) FROM table_name; We have a table "employee" as below: employee id first_name last_nam...

Difference between TRUNCATE and DROP in MySQL.

TRUNCATE TRUNCATE comes under DDL(Data Definition Language). TRUNCATE removes only rows from the table but the structure of the table remains same. Data can not be roll backed if we use "TRUNCATE" command to delete data. Can not use WHERE...

What is DEFAULT Constraint in MySQL?

In MySQL, the DEFAULT constraint is used to insert value into a column in a table. If there is no value is specified for a column then the default value will be added to column for all new records. DEFAULT Constraint on CREATE TABLE The fol...

What is CHECK Constraint in MySQL?

In MySQL, the CHECK constraint is used to put limit on value range on value inside a column. CHECK Constraint on CREATE TABLE The following statement creates a CHECK constraint on the "id" column when the "employee" table is created. The CH...

What is FOREIGN KEY Constraint in MySQL?

Note that the "P_Id" column in the "Orders" table points to the "P_Id" column in the "Persons" table. In MySQL, the FOREIGN KEY on one table is used to point a PRIMARY KEY in another table. We have two tables with the following values. ...

What is PRIMARY KEY Constraint in MySQL?

In MySQL, the PRIMARY KEY constraint is used to uniquely identify each record in a table. Primary key contains UNIQUE values only and the column defined as Primary key column can not be NULL. A table can have only one PRIMARY KEY. PRIMARY K...

SQL Tutorial -> Sql Inner Join

<-- Chapter 25: SQL Join Chapter 26 SQL Inner Join SQL Inner Join clause is used to fetch all the rows from more than two tables in which there is a match between the columns. Inner Join is similar like Join clause. Lets see an ...

What is UNIQUE Constraint in MySQL?

In MySQL, the UNIQUE constraint is used to uniquely identify each record in a table. UNIQUE Constraint on CREATE TABLE The following statement creates a UNIQUE constraint on the "id" column when the "employee" table is created: Example ...
prev 1 3
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: