"cells": [
{
"cell_type": "heading",
- "level": 1,
+ "level": 2,
"metadata": {},
"source": [
"Sorting and Removing Duplicates"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "cell_tags": [
+ "objectives"
+ ]
+ },
+ "source": [
+ "#### Objectives\n",
+ "\n",
+ "* Write queries that display results in a particular order.\n",
+ "* Write queries that eliminate duplicate values from data."
+ ]
+ },
{
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"output_type": "display_data",
"text": [
- "<IPython.core.display.HTML at 0x1023cbe10>"
+ "<IPython.core.display.HTML at 0x102358c90>"
]
}
],
"metadata": {},
"output_type": "display_data",
"text": [
- "<IPython.core.display.HTML at 0x1023cbf10>"
+ "<IPython.core.display.HTML at 0x102358d90>"
]
}
],
"metadata": {},
"output_type": "display_data",
"text": [
- "<IPython.core.display.HTML at 0x1023cbf10>"
+ "<IPython.core.display.HTML at 0x102353c90>"
]
}
],
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Challenges\n",
+ "#### Challenges\n",
"\n",
"1. Write a query that selects distinct dates from the `Site` table."
]
"metadata": {},
"output_type": "display_data",
"text": [
- "<IPython.core.display.HTML at 0x1023cbe90>"
+ "<IPython.core.display.HTML at 0x102353b10>"
]
}
],
"metadata": {},
"output_type": "display_data",
"text": [
- "<IPython.core.display.HTML at 0x1023cbe10>"
+ "<IPython.core.display.HTML at 0x102353c50>"
]
}
],
"metadata": {},
"output_type": "display_data",
"text": [
- "<IPython.core.display.HTML at 0x1023c4090>"
+ "<IPython.core.display.HTML at 0x1023557d0>"
]
}
],
"metadata": {},
"output_type": "display_data",
"text": [
- "<IPython.core.display.HTML at 0x1023c96d0>"
+ "<IPython.core.display.HTML at 0x102353b10>"
]
}
],
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Challenges\n",
+ "#### Challenges\n",
+ "\n",
+ "1. Write a query that returns the distinct dates in the `Visited` table.\n",
+ "\n",
+ "2. Write a query that displays the full names of the scientists in the `Person` table, ordered by family name."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "cell_tags": [
+ "keypoints"
+ ]
+ },
+ "source": [
+ "#### Key Points\n",
"\n",
- "FIXME"
+ "* The records in a database table are not intrinsically ordered:\n",
+ " if we want to display them in some order,\n",
+ " we must specify that explicitly.\n",
+ "* The values in a database are not guaranteed to be unique:\n",
+ " if we want to eliminate duplicates,\n",
+ " we must specify that explicitly as well."
]
}
],