---
isPrivate: true
title: DDSQL (Preview) Common Queries and Use Cases
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > DDSQL Reference > DDSQL (Preview) Common Queries and Use Cases
---

# DDSQL (Preview) Common Queries and Use Cases

{% alert level="danger" %}
There are two different **variants** of DDSQL. The examples in this guide use DDSQL (Preview) Syntax. See the syntax documented in [DDSQL Reference](https://docs.datadoghq.com/ddsql_reference.md).
{% /alert %}

## General queries{% #general-queries %}

### List all libraries across services in production{% #list-all-libraries-across-services-in-production %}

```sql
SELECT
    c.service_name,
    c.team,
    lib.library_name,
    lib.eol,
    lib.last_commit,
    lib.newer_versions_number,
    lib.library_version,
    lib.latest_version,
    lib.ecosystem,
    lib.language,
    lib.license,
    lib.license_type
FROM service_definition c
JOIN library lib ON lib.asset_name = c.service_name
WHERE
    lib.env = 'production'
    AND lib.relation = 'DIRECT'
    AND LOWER(c.domain) = 'domain_name'
    AND LOWER(c.vertical) = 'account'
    AND LOWER(c.type) = 'service'
ORDER BY lib.newer_versions_number DESC
```

### List services running an old version of the SDK{% #list-services-running-an-old-version-of-the-sdk %}

```sql
SELECT *
FROM service_config
WHERE client_library_version < '1.31.0';
```

## AWS{% #aws %}

### List of RDS instances that require SSL/TLS certificate rotation{% #list-of-rds-instances-that-require-ssltls-certificate-rotation %}

```sql
SELECT account_id,
  aws_organisation,
  aws_environment db_instance_identifier,
  display_name,
  ca_certificate_identifier,
  engine,
  engine_version,
  tags
FROM aws_rds_instance
WHERE ca_certificate_identifier like 'rds-ca-2019'
```

### List EBS snapshots in progress{% #list-ebs-snapshots-in-progress %}

```sql
SELECT description,
  account_id,
  progress
FROM aws_ebs_snapshot
WHERE LOWER(state) != 'completed'
  and LOWER(state) != 'available'
```

### List lambda functions with a specific outdated runtime (in this case python 2.7){% #list-lambda-functions-with-a-specific-outdated-runtime-in-this-case-python-27 %}

```sql
SELECT *
FROM aws_lambda_function
WHERE runtime = 'python2.7'
LIMIT 100;
```

## Further reading{% #further-reading %}

- [Learn more about the DDSLQ Editor](https://docs.datadoghq.com/ddsql_editor.md)
