LIMIT clause:

  • LIMIT clause:

This clause is used in SELECT statement to constraint the numbers of rows in the result.
. Syntax:
SELECT col1, col2, …….
FROM table
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,


LIKE operator:

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.


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


IN/BETWEEN operator:

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.
. Syntax:
(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:

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.
Truth table:

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

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.

Querying data using SELECT and DISTINCT :

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 :
       Select column1,column2,column3,……………………………
       From table_name1
       (inner | left | right) join table_name2 on conditions
       Where conditions
       Group by column
       Having group_conditions
       Order by columnN
       Limit offset, length;
Where N = 1,2,3,……………………………………..
This is only overview of clauses . All of them will be discussed later.

How to access xampp from another computer

  1. If you are using windows than all you have to do is to go to Allow an app through <a href=”” rel=”nofollow”>Windows</a> Firewall.
  2. Click on Allow another app select Apache and mark public and private both.
  3. Again Allow another app this time select xampp and mark both public and private and then click apply and exit .
  4. Open cmd by pressing windows button+r.
  5. Write cmd than in cmd write ipconfig find out your IP.
  6. Open up your browser write down your ip http://192.168.1.x and you will be on the xampp startup page.
  7. If you want to access your local site simply put / infront of your ip
  8. E.g http://192.168.1.x/yousite.
    Now you are able to access your website in private network computers .
Copyright © 2016 InfoxIT Portal. All rights reserved.
Seo wordpress plugin by
Scroll To Top
Visit Us On FacebookVisit Us On Google PlusVisit Us On YoutubeCheck Our Feed