Select Statement

 

 The LDAP-SQL SELECT statement queries data from ldap. The statement begins with the SELECT keyword. The basic SELECT statement has 4 clauses:

 

The SELECT clause specifies the attributes that are retrieved. The FROM clause specifies the entries accessed. The WHERE clause specifies the condition. The WHERE clause is optional; if missing, all the entries within the container will be returned depending upon the query scope. The QUERY SCOPE is new for ldap query, if missing the default is subtree scope and will return all the subentries (you can change the default from the radio buttons at the bottom of sql editor)

 

To select all the entries within an entry (including entry and all its subentries) you type sql statement as:

Select * from DC=LDAPSOFT,DC=COM

This sql will return all the entries in the DC=LDAPSOFT,DC=COM container as the default scope is subtree scope, the above sql statement is same as :

Select * from DC=LDAPSOFT,DC=COM subtreescope

 

To select only the immediate children you type sql statement as:

Select * from DC=LDAPSOFT,DC=COM onelevelscope

 

To select the entry only you type sql statement as:

Select * from DC=LDAPSOFT,DC=COM basescope

 

 

 

Note:  You don't have to provide the scope (subtreescope , onelevelscope or basescope) in the sql statement. You can select it from the radio button at the bottom of the editor window

 

 

 

If the sql statement contains the scope it will take precedence over the scope selected using the radio buttons

 

 

 

Query

Scope Selected

(Radio Button)

Results of Query

 

1) Select * from DC=LDAPSOFT,DC=COM

Base Only

Only 1 Entry is returned ( DC=LDAPSOFT,DC=COM)

2) Select * from DC=LDAPSOFT,DC=COM

One Level

All the immediate children of DC=LDAPSOFT,DC=COM are returned excluding entry DC=LDAPSOFT,DC=COM

3) Select * from DC=LDAPSOFT,DC=COM

Sub Tree

All entries within DC=LDAPSOFT,DC =COM are returned including DC=LDAPSOFT,DC=COM and all its subentries.

4) Select * from DC=LDAPSOFT,DC=COM basescope

N/A (as the scope in the sql statement will take precedence)

Same as 1

Only 1 Entry is returned ( DC=LDAPSOFT,DC=COM)

5) Select * from DC=LDAPSOFT,DC=COM onelevelscope

N/A (as the scope in the sql statement will take precedence)

Same as 2

All the immediate children of DC=LDAPSOFT,DC=COM are returned excluding entry DC=LDAPSOFT,DC=COM

6) Select * from DC=LDAPSOFT,DC=COM subtreescope

N/A (as the scope in the sql statement will take precedence)

Same as 3

All entries within DC=LDAPSOFT,DC=COM are returned including DC=LDAPSOFT,DC=COM and all its subentries.

 

 

You can also generate the simple type of sql select statement from the popup menu

 

 

Related Links:

Select statement

Select statement Exampes

Update statement

Insert statement

Delete statement examples

 

 


Ldapsoft Home page LDAP Admin & Reporting Tool Home Page