We are pleased that our Advisory Software Consultant “Suman Tiwari ” is bestowed with CPISI (Certified Payment Card Industry Security Implementer) certification.
many Congratulation Suman.
Details can be viewed here: https://sisainfosec.com/training/certified-professionals/read/2667
This clause is used in SELECT statement to constraint the numbers of rows in the result.
SELECT col1, col2, …….
LIMIT offset, count;
Where, offset specifies first row to return. The offset of row start from 0 ,not 1.
And count specifies maximum number of rows to return.
. Example 1: select first five employee.
.Example 2: Find first five employee whose salary is maximum then others.
OR like this way,
It is used to select the data from table based on specific pattern.It is used in WHERE clause of SELECT statement.
There are two wild card used in LIKE operator i.e.% and _.
. % : Percentage is used to match zero or more character. Eg, ‘S%’ gives the data staring from S. That can be like Sam, Sameer, Sajhan ,etc.
. _: Underscore is used to match one character.Eg.’r_n’: ran, run.
Here is employee table with their attribute eid, name, address, salary, gender, phoneno and mid.
- Example of %:
- Select name that start from s in employee table.
- Select name that end with a .
- Select name that contain a.
- Example of _:Show whose name start from ‘s’ and end with ‘a’ with 2 character between them.
1. IN operator:
IN operator determine if a specified value matches any one of the list or a sub query.
IN operator return 1 if the value of column or the expression is equal to given list or sub-query, else return 0.
IN operator is used in WHERE clause.
(exp|operation) in (‘value1’ , ’ value2’ , ……)
Where, IN operator works as OR operator.
Above example can be written as:
When you don’t want values of the given list then you can use NOT IN operator in query.
AND/OR operator is used to combine Boolean expression for filtering data.
These operator is used in WHERE clause.
1. AND operator :
It is a logical operator that combines two or more Boolean expressions and
Return true if both expression evaluate true.
Or if any one expression is false then final evaluation is false.
WHRE expression1 AND expression2;
There is database organization with employee table, given below:
. Example 1:
Show employe id and name whose gender is male and salary is greater than 70000.
You can use more than one AND operator , when it is needed.
. Example 2:
Show employe id and name whose gender is male , salary is greater than 70000 and address is butwal.
Where clause is used to extract rows from the table based on particular expression or condition.
Whenever you write the statement in the database console. At first, program will start from where clause (has higher precedence among clauses).
where clause is search by program to perform conditions or operations. If it satisfy then selects row . And select statement looks for which column to be display.
Here, where select the whose name is ‘suman’ and select statement select’s all column from
The table and shows result.
. Comparision operator used in where clause:
1 = equal to
2 != not equal to
3 > greater than
4 < less than
5 >= greater than or equal to
6 =< less than or equal to.
In above example, = operator is used.
.In where clause, and , or ,in , between, etc are used for conditional operations.
All of them will discuss later topics.
• Select Clause and overview of clauses:
The table consists of rows and columns. Row is called tuple or the instance of table(or entity) and Column is called attribute of table (or entity).
The select statement allow you to get related information from table or views.
The result of select is list of the rows, each consists of same number of column.
The select statement controls which column or rows you needed.
Syntax for select statement :
(inner | left | right) join table_name2 on conditions
Group by column
Order by columnN
Limit offset, length;
Where N = 1,2,3,……………………………………..
This is only overview of clauses . All of them will be discussed later.