Softerra LDAP Administrator Help | Show AllHide All |
The SELECT statement is used to search for LDAP entries in a directory.
SELECT attributes FROM Search-DN [WHERE where-clause] [SCOPE search-scope] [REFERRALS true|false] [PAGESIZE size-num]
Keyword | Description |
---|---|
SELECT | Specifies a comma-separated list of LDAP attributes to retrieve for each found entry. For example: $cn, $sn, $mail, $telephonenumber. If you don't need any attribute values, you can either specify nothing or set (*). If you specify COUNT(*) instead of LDAP attributes, then the result of performing the statement will be the number of entries found. |
FROM | Specifies the base DN of the search. If the base DN is empty or ROOTDSE, the search starts from the RootDSE. |
WHERE | An optional keyword that specifies the query filter. |
SCOPE | An optional keyword used to define the scope of the search. Can be ONELEVEL, SUBTREE, and BASE. Use ONELEVEL to find entries within a single level of Search-DN subentries, SUBTREE to find all entries located under the Search-DN and BASE to find only the Search-DN entry. The default value is SUBTREE. |
REFERRALS | An optional keyword used to define whether to handle referrals during the search. Possible values are TRUE and FALSE. If this parameter is not defined, referrals are not handled. |
PAGESIZE | An optional keyword used to define the number of entries to be returned per one search request. For more details refer to the Paging Overview section. If this parameter is not defined, the size-num is 200. |
Search for all entries under DC=company,DC=com.
SELECT * FROM "DC=company,DC=com"
Find all users in the directory. The search is performed with handling of referrals; page size set to 500.
SELECT * FROM ROOTDSE WHERE $objectClass='user' AND $objectCategory='Person' REFERRALS TRUE
Search for all immediate children of OU=Users,DC=com whose displayName attribute doesn't match the cn attribute.
SELECT * FROM "OU=Users,DC=company" WHERE $displayName!=$cn SCOPE ONELEVEL
Find all entries in OU=Users,DC=com that were modified during the last week.
SELECT * FROM "OU=Users,DC=company" WHERE modifyTimestamp <= CURRENT_DATE AND modifyTimestamp >= CURRENT_DATE - interval "7 days"
Find all groups with the description attribute containing the word 'temporary' that are located directly under the "OU=Groups,DC=company".
SELECT FROM "OU=Groups,DC=company" WHERE $description='*temporary*' SCOPE ONELEVEL;
Count all entries under "OU=Umbrella,DC=company".
SELECT COUNT(*) FROM "OU=Umbrella,DC=company"
Count all users without userPpassword attribute in "CN=Users,DC=company".
SELECT COUNT(*) FROM "OU=Users,DC=company" WHERE $objectClass='user' AND $objectCategory='Person' AND userPassword IS NULL