# nobel table

| yr   | subject    | winner                      |
| ---- | ---------- | --------------------------- |
| 1960 | Chemistry  | Willard F. Libby            |
| 1960 | Literature | Saint-John Perse            |
| 1960 | Medicine   | Sir Frank Macfarlane Burnet |
| 1960 | Medicine   | Peter Madawar               |
|      |            | ...                         |

## Apostrophe

Find all details of the prize won by EUGENE O'NEILL

```php
SELECT *
FROM nobel
WHERE winner = 'EUGENE O''NEILL';
```

Note: Escaping single quotes

You can't put a single quote in a quote string directly. You can **use two single quotes within a quoted string**.

## Chemistry and Physics last

Show the 1984 winners and subject ordered by subject and winner name; but list Chemistry and Physics last.

```php
SELECT winner, subject
FROM nobel
WHERE yr = 1984
ORDER BY subject IN ('Chemistry','Physics'), subject, winner;
```

Note: The expression **subject IN ('Chemistry','Physics')** can be used as a value - it will be **0** or **1**. Here we order by this value first, such that Chemistry and Physics stay at the last.

## The amount of years where no Medicine awards were given

```php
SELECT COUNT(DISTINCT yr) 
FROM nobel
WHERE yr NOT IN (SELECT DISTINCT yr FROM nobel WHERE subject = 'Medicine');
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lei-d.gitbook.io/sql/sqlzoo/nobel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
