Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 5 additions & 65 deletions dsc_c1w1m3_practice2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,7 @@
"cell_type": "code",
"source": [
"# Your code here\n",
"\n",
"q = \"\"\"\n",
"SELECT firstName, lastName, city, state\n",
"FROM employees\n",
"JOIN offices\n",
" USING(officeCode)\n",
"ORDER BY firstName, lastName\n",
";\n",
"\"\"\"\n",
"df = pd.read_sql(q, conn)\n",
"print('Total number of results:', len(df))\n",
"df.head()\n"
"\n"
],
"metadata": {
"colab": {
Expand Down Expand Up @@ -406,22 +395,7 @@
"cell_type": "code",
"source": [
"# Your code here\n",
"\n",
"q = \"\"\"\n",
"SELECT\n",
" contactFirstName,\n",
" contactLastName,\n",
" orderNumber,\n",
" orderDate,\n",
" status\n",
"FROM customers\n",
"JOIN orders\n",
" USING(customerNumber)\n",
";\n",
"\"\"\"\n",
"df = pd.read_sql(q, conn)\n",
"print('Total number of results:', len(df))\n",
"df.head()"
"\n"
],
"metadata": {
"colab": {
Expand Down Expand Up @@ -759,22 +733,7 @@
"cell_type": "code",
"source": [
"# Your code here\n",
"\n",
"q = \"\"\"\n",
"SELECT\n",
" contactFirstName,\n",
" contactLastName,\n",
" amount,\n",
" paymentDate\n",
"FROM customers\n",
"JOIN payments\n",
" USING(customerNumber)\n",
"ORDER BY amount DESC\n",
";\n",
"\"\"\"\n",
"df = pd.read_sql(q, conn)\n",
"print('Total number of results:', len(df))\n",
"df.head()\n"
"\n"
],
"metadata": {
"colab": {
Expand Down Expand Up @@ -1107,26 +1066,7 @@
"cell_type": "code",
"source": [
"# Your code here\n",
"\n",
"q = \"\"\"\n",
"SELECT\n",
" contactFirstName,\n",
" contactLastName,\n",
" productName,\n",
" quantityOrdered,\n",
" orderDate\n",
"FROM customers\n",
"JOIN orders\n",
" USING(customerNumber)\n",
"JOIN orderdetails\n",
" USING(orderNumber)\n",
"JOIN products\n",
" USING (productCode)\n",
"ORDER BY orderDate DESC\n",
";\"\"\"\n",
"df = pd.read_sql(q, conn)\n",
"print('Total number of results:', len(df))\n",
"df.head()\n"
"\n"
],
"metadata": {
"colab": {
Expand Down Expand Up @@ -1457,4 +1397,4 @@
]
}
]
}
}