| [ | |
| { | |
| "text": "[MUSIC PLAYING]", | |
| "start": 0.0, | |
| "duration": 4.9 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Well, hello, one and all,\nand welcome to CS50's Introduction to", | |
| "start": 17.65, | |
| "duration": 4.08 | |
| }, | |
| { | |
| "text": "Databases with SQL.", | |
| "start": 21.73, | |
| "duration": 1.8 | |
| }, | |
| { | |
| "text": "My name is Carter Zenke.", | |
| "start": 23.53, | |
| "duration": 1.62 | |
| }, | |
| { | |
| "text": "And in this course, you'll learn how to\nrepresent, how to organize and manage,", | |
| "start": 25.15, | |
| "duration": 4.77 | |
| }, | |
| { | |
| "text": "and how to ask questions of\nthe data that's around you", | |
| "start": 29.92, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "in your everyday life.", | |
| "start": 32.17, | |
| "duration": 2.2 | |
| }, | |
| { | |
| "text": "But why learn those skills?", | |
| "start": 34.37, | |
| "duration": 2.24 | |
| }, | |
| { | |
| "text": "Well, you may have heard we're living in\nthe information age, where we generate", | |
| "start": 36.61, | |
| "duration": 3.91 | |
| }, | |
| { | |
| "text": "so much information, so much\ndata by virtue of interaction", | |
| "start": 40.52, | |
| "duration": 3.14 | |
| }, | |
| { | |
| "text": "with computers and with each\nother over the internet.", | |
| "start": 43.66, | |
| "duration": 3.07 | |
| }, | |
| { | |
| "text": "You might think of, let's say, Google\nkeeping track of the sites you click on", | |
| "start": 46.73, | |
| "duration": 3.89 | |
| }, | |
| { | |
| "text": "or the sites you search for.", | |
| "start": 50.62, | |
| "duration": 1.65 | |
| }, | |
| { | |
| "text": "You could think of maybe the smartphone\nin your pocket or the smartwatch", | |
| "start": 52.27, | |
| "duration": 3.36 | |
| }, | |
| { | |
| "text": "on your wrist keeping track\nof health information, emails,", | |
| "start": 55.63, | |
| "duration": 3.13 | |
| }, | |
| { | |
| "text": "text messages, and so on.", | |
| "start": 58.76, | |
| "duration": 1.98 | |
| }, | |
| { | |
| "text": "You might even think\nof YouTube, where you", | |
| "start": 60.74, | |
| "duration": 2.15 | |
| }, | |
| { | |
| "text": "might be watching this same\nvideo keeping track of all", | |
| "start": 62.89, | |
| "duration": 2.64 | |
| }, | |
| { | |
| "text": "the videos on their platform,\nthe creators of those videos,", | |
| "start": 65.53, | |
| "duration": 2.94 | |
| }, | |
| { | |
| "text": "and even the comment you\nmight leave on this video.", | |
| "start": 68.47, | |
| "duration": 3.72 | |
| }, | |
| { | |
| "text": "So although, we're living in\nthis information age, where", | |
| "start": 72.19, | |
| "duration": 2.94 | |
| }, | |
| { | |
| "text": "there is so much data,\nso much information,", | |
| "start": 75.13, | |
| "duration": 2.64 | |
| }, | |
| { | |
| "text": "we can use these new tools,\nlike database and SQL,", | |
| "start": 77.77, | |
| "duration": 2.43 | |
| }, | |
| { | |
| "text": "to interact with that information\nto store it and manage it.", | |
| "start": 80.2, | |
| "duration": 3.718 | |
| }, | |
| { | |
| "text": "And although we're using\nsome of these new tools,", | |
| "start": 83.918, | |
| "duration": 2.042 | |
| }, | |
| { | |
| "text": "some of the other concepts we'll\nlearn aren't actually so new.", | |
| "start": 85.96, | |
| "duration": 3.6 | |
| }, | |
| { | |
| "text": "So here is a diagram from\nliterally a few thousand years ago.", | |
| "start": 89.56, | |
| "duration": 5.13 | |
| }, | |
| { | |
| "text": "And notice how this diagram\nhas rows and columns.", | |
| "start": 94.69, | |
| "duration": 4.71 | |
| }, | |
| { | |
| "text": "And this seems to store the\nstipends for workers at a temple", | |
| "start": 99.4, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "some few thousand years ago.", | |
| "start": 103.27, | |
| "duration": 1.9 | |
| }, | |
| { | |
| "text": "So given what you know based on your\nprior knowledge, what kind of name", | |
| "start": 105.17, | |
| "duration": 5.03 | |
| }, | |
| { | |
| "text": "might you give this diagram\nwith rows and with columns?", | |
| "start": 110.2, | |
| "duration": 4.83 | |
| }, | |
| { | |
| "text": "What can we give a name to for this?", | |
| "start": 115.03, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "So I'm seeing some ideas of a table,\nperhaps a spreadsheet as well.", | |
| "start": 118.12, | |
| "duration": 4.41 | |
| }, | |
| { | |
| "text": "For our purposes, we'll\ncall this a table, where", | |
| "start": 122.53, | |
| "duration": 2.73 | |
| }, | |
| { | |
| "text": "a table stores some set of information.", | |
| "start": 125.26, | |
| "duration": 2.999 | |
| }, | |
| { | |
| "text": "And every row in that\ntable stores one item", | |
| "start": 128.259, | |
| "duration": 4.111 | |
| }, | |
| { | |
| "text": "in that set, where every column\nhas some piece of information", | |
| "start": 132.37, | |
| "duration": 3.39 | |
| }, | |
| { | |
| "text": "about that item, some\nattribute of that item.", | |
| "start": 135.76, | |
| "duration": 2.83 | |
| }, | |
| { | |
| "text": "So here, for example, we do have\na table of workers at a temple.", | |
| "start": 138.59, | |
| "duration": 3.95 | |
| }, | |
| { | |
| "text": "Every row is one worker.", | |
| "start": 142.54, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "And every column is their\nstipend for a particular month.", | |
| "start": 144.79, | |
| "duration": 4.42 | |
| }, | |
| { | |
| "text": "So I could take this idea of a\ntable, this very ancient idea,", | |
| "start": 149.21, | |
| "duration": 3.8 | |
| }, | |
| { | |
| "text": "and apply it to a more modern context.", | |
| "start": 153.01, | |
| "duration": 2.65 | |
| }, | |
| { | |
| "text": "So let's say I'm a\nlibrarian, for instance.", | |
| "start": 155.66, | |
| "duration": 3.15 | |
| }, | |
| { | |
| "text": "I want to organize my library.", | |
| "start": 158.81, | |
| "duration": 2.42 | |
| }, | |
| { | |
| "text": "Well, here I have book\ntitles and authors.", | |
| "start": 161.23, | |
| "duration": 3.3 | |
| }, | |
| { | |
| "text": "And I could certainly use a\ntable to store this information.", | |
| "start": 164.53, | |
| "duration": 2.88 | |
| }, | |
| { | |
| "text": "But how might you propose\nI store this information?", | |
| "start": 167.41, | |
| "duration": 3.96 | |
| }, | |
| { | |
| "text": "What could I do with my\nrows and with my columns", | |
| "start": 171.37, | |
| "duration": 3.27 | |
| }, | |
| { | |
| "text": "if I have book titles and book authors?", | |
| "start": 174.64, | |
| "duration": 3.66 | |
| }, | |
| { | |
| "text": "I see one thing I could do is probably\norganize my titles and my authors", | |
| "start": 178.3, | |
| "duration": 5.1 | |
| }, | |
| { | |
| "text": "next to each other like this.", | |
| "start": 183.4, | |
| "duration": 1.778 | |
| }, | |
| { | |
| "text": "I could take my titles to my authors,\nput them right next together.", | |
| "start": 185.178, | |
| "duration": 2.792 | |
| }, | |
| { | |
| "text": "So I have Song of\nSolomon by Toni Morrison,", | |
| "start": 187.97, | |
| "duration": 2.45 | |
| }, | |
| { | |
| "text": "Goodnight Moon by Margaret Wise Brown.", | |
| "start": 190.42, | |
| "duration": 1.89 | |
| }, | |
| { | |
| "text": "And notice hear how\neach book is one row.", | |
| "start": 192.31, | |
| "duration": 3.67 | |
| }, | |
| { | |
| "text": "But every row has two columns worth two\npieces of information for each book.", | |
| "start": 195.98, | |
| "duration": 5.66 | |
| }, | |
| { | |
| "text": "I have a title for one column\nand an author for the other.", | |
| "start": 201.64, | |
| "duration": 4.33 | |
| }, | |
| { | |
| "text": "And so together, I have a table of\nbooks where every column tells me", | |
| "start": 205.97, | |
| "duration": 3.98 | |
| }, | |
| { | |
| "text": "one piece of information.", | |
| "start": 209.95, | |
| "duration": 1.26 | |
| }, | |
| { | |
| "text": "And every row tells me\none book in this data set.", | |
| "start": 211.21, | |
| "duration": 5.23 | |
| }, | |
| { | |
| "text": "So thankfully, now that we're\nliving in this information age,", | |
| "start": 216.44, | |
| "duration": 4.01 | |
| }, | |
| { | |
| "text": "we no longer have to use stone\ntablets or perhaps pencil and paper", | |
| "start": 220.45, | |
| "duration": 5.31 | |
| }, | |
| { | |
| "text": "to store our tables.", | |
| "start": 225.76, | |
| "duration": 1.35 | |
| }, | |
| { | |
| "text": "We have software now like Apple Numbers,\nGoogle Sheets, and Microsoft Excel.", | |
| "start": 227.11, | |
| "duration": 4.44 | |
| }, | |
| { | |
| "text": "But this isn't a course on Apple\nNumbers or Microsoft Excel or so on.", | |
| "start": 231.55, | |
| "duration": 5.5 | |
| }, | |
| { | |
| "text": "It's actually a course\non databases and on SQL.", | |
| "start": 237.05, | |
| "duration": 3.29 | |
| }, | |
| { | |
| "text": "So feel free to raise your\nhand if you'd like, but why", | |
| "start": 240.34, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "would we decide to move\nalong from these spreadsheet", | |
| "start": 243.97, | |
| "duration": 3.39 | |
| }, | |
| { | |
| "text": "softwares towards a database?", | |
| "start": 247.36, | |
| "duration": 3.06 | |
| }, | |
| { | |
| "text": "What might that database give us\nthat a spreadsheet might not give us?", | |
| "start": 250.42, | |
| "duration": 4.2 | |
| }, | |
| { | |
| "text": "So I'm seeing a few ideas here and\namong them are some simplicity,", | |
| "start": 254.62, | |
| "duration": 3.719 | |
| }, | |
| { | |
| "text": "some ability to organize some data.", | |
| "start": 258.339, | |
| "duration": 2.506 | |
| }, | |
| { | |
| "text": "But there are a few\nother ideas which I think", | |
| "start": 260.845, | |
| "duration": 1.875 | |
| }, | |
| { | |
| "text": "about too for why we might move beyond\nspreadsheets and go towards databases.", | |
| "start": 262.72, | |
| "duration": 4.02 | |
| }, | |
| { | |
| "text": "Now one of these is this idea of scale.", | |
| "start": 266.74, | |
| "duration": 2.79 | |
| }, | |
| { | |
| "text": "So let's say you are a\nGoogle or an Instagram.", | |
| "start": 269.53, | |
| "duration": 3.3 | |
| }, | |
| { | |
| "text": "You're trying to store\nnot just tens of thousands", | |
| "start": 272.83, | |
| "duration": 2.28 | |
| }, | |
| { | |
| "text": "of users or hundreds of\nthousands but literally", | |
| "start": 275.11, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "millions of users or billions of users.", | |
| "start": 277.15, | |
| "duration": 2.7 | |
| }, | |
| { | |
| "text": "And with that kind of scale may\nbe better served by a database", | |
| "start": 279.85, | |
| "duration": 3.6 | |
| }, | |
| { | |
| "text": "to store that much information.", | |
| "start": 283.45, | |
| "duration": 2.8 | |
| }, | |
| { | |
| "text": "Another reason to move from\nspreadsheets to databases", | |
| "start": 286.25, | |
| "duration": 3.65 | |
| }, | |
| { | |
| "text": "is the idea of being able to\nupdate data more frequently.", | |
| "start": 289.9, | |
| "duration": 3.27 | |
| }, | |
| { | |
| "text": "Maybe you're a Twitter\nof the world, and you're", | |
| "start": 293.17, | |
| "duration": 2.01 | |
| }, | |
| { | |
| "text": "trying to have others tweet\nmultiple times per second.", | |
| "start": 295.18, | |
| "duration": 2.88 | |
| }, | |
| { | |
| "text": "Well, a database can handle\nthat kind of capacity", | |
| "start": 298.06, | |
| "duration": 2.85 | |
| }, | |
| { | |
| "text": "much better than a\nspreadsheet could alone.", | |
| "start": 300.91, | |
| "duration": 3.15 | |
| }, | |
| { | |
| "text": "And a third reason to move\nbeyond this might be speed.", | |
| "start": 304.06, | |
| "duration": 4.12 | |
| }, | |
| { | |
| "text": "Let's say I'm trying to look up some\npiece of information in my database.", | |
| "start": 308.18, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "Well, I could do that much\nfaster with a database", | |
| "start": 311.81, | |
| "duration": 2.51 | |
| }, | |
| { | |
| "text": "than I could with a spreadsheet.", | |
| "start": 314.32, | |
| "duration": 1.35 | |
| }, | |
| { | |
| "text": "You could think of yourself using\nCommand-F or Control-F to find", | |
| "start": 315.67, | |
| "duration": 2.73 | |
| }, | |
| { | |
| "text": "a piece of information\nin your spreadsheet,", | |
| "start": 318.4, | |
| "duration": 1.86 | |
| }, | |
| { | |
| "text": "going one by one through the rows.", | |
| "start": 320.26, | |
| "duration": 2.07 | |
| }, | |
| { | |
| "text": "A database gives you\naccess to more kinds", | |
| "start": 322.33, | |
| "duration": 2.22 | |
| }, | |
| { | |
| "text": "of algorithms you could use to search\nthis data much faster, ultimately.", | |
| "start": 324.55, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "So these three reasons,\namong others, are", | |
| "start": 328.54, | |
| "duration": 2.73 | |
| }, | |
| { | |
| "text": "those might want to move beyond\nspreadsheets and start using databases.", | |
| "start": 331.27, | |
| "duration": 4.95 | |
| }, | |
| { | |
| "text": "Now, it's worth thinking\nfirst, what is a database?", | |
| "start": 336.22, | |
| "duration": 4.217 | |
| }, | |
| { | |
| "text": "We'll be talking about databases\nthroughout this course.", | |
| "start": 340.437, | |
| "duration": 2.333 | |
| }, | |
| { | |
| "text": "So what is a database?", | |
| "start": 342.77, | |
| "duration": 1.76 | |
| }, | |
| { | |
| "text": "Well, a database is simply some\nway to organize your data such", | |
| "start": 344.53, | |
| "duration": 3.9 | |
| }, | |
| { | |
| "text": "that you can actually create data,\nupdate data, read data, and delete", | |
| "start": 348.43, | |
| "duration": 5.64 | |
| }, | |
| { | |
| "text": "data.", | |
| "start": 354.07, | |
| "duration": 0.51 | |
| }, | |
| { | |
| "text": "And often these our for interactions\nthat we'll do with a database--", | |
| "start": 354.58, | |
| "duration": 3.18 | |
| }, | |
| { | |
| "text": "like adding some data, looking at data,\ndeleting data, and even updating it", | |
| "start": 357.76, | |
| "duration": 4.41 | |
| }, | |
| { | |
| "text": "along the way.", | |
| "start": 362.17, | |
| "duration": 1.38 | |
| }, | |
| { | |
| "text": "But the database isn't the\nonly thing in our picture here.", | |
| "start": 363.55, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "We also have a database\nmanagement system,", | |
| "start": 366.64, | |
| "duration": 3.075 | |
| }, | |
| { | |
| "text": "a way to interact with our database.", | |
| "start": 369.715, | |
| "duration": 3.465 | |
| }, | |
| { | |
| "text": "So you might think of perhaps\nwriting a program on your computer.", | |
| "start": 373.18, | |
| "duration": 4.17 | |
| }, | |
| { | |
| "text": "You have some interface\nwith to write that program,", | |
| "start": 377.35, | |
| "duration": 2.16 | |
| }, | |
| { | |
| "text": "like VS Code for instance.", | |
| "start": 379.51, | |
| "duration": 1.74 | |
| }, | |
| { | |
| "text": "Or you might think of your own\ndesktop on your own computer.", | |
| "start": 381.25, | |
| "duration": 2.61 | |
| }, | |
| { | |
| "text": "You have icons that you interact\nwith the underlying operating system.", | |
| "start": 383.86, | |
| "duration": 3.48 | |
| }, | |
| { | |
| "text": "In the same way, we can use this\nsoftware called a database management", | |
| "start": 387.34, | |
| "duration": 4.32 | |
| }, | |
| { | |
| "text": "system, or a DBMS for short, to\ninteract with a database perhaps", | |
| "start": 391.66, | |
| "duration": 3.78 | |
| }, | |
| { | |
| "text": "using a graphical interface or\nusing a textual language too.", | |
| "start": 395.44, | |
| "duration": 5.03 | |
| }, | |
| { | |
| "text": "Now, there are a few varieties\nof database management softwares.", | |
| "start": 400.47, | |
| "duration": 5.555 | |
| }, | |
| { | |
| "text": "And these are a few of them here.", | |
| "start": 406.025, | |
| "duration": 1.375 | |
| }, | |
| { | |
| "text": "MySQL, Oracle, PostgreSQL, and SQLite.", | |
| "start": 407.4, | |
| "duration": 3.84 | |
| }, | |
| { | |
| "text": "But this is a non-exhaustive list.", | |
| "start": 411.24, | |
| "duration": 2.2 | |
| }, | |
| { | |
| "text": "So let me also ask again, what kinds\nof other database management systems", | |
| "start": 413.44, | |
| "duration": 4.25 | |
| }, | |
| { | |
| "text": "have you perhaps heard of in this case?", | |
| "start": 417.69, | |
| "duration": 3.43 | |
| }, | |
| { | |
| "text": "I'm seeing one for Microsoft\nAccess, perhaps, MongoDB.", | |
| "start": 421.12, | |
| "duration": 4.52 | |
| }, | |
| { | |
| "text": "There are other kinds of softwares,\nother companies out there that make", | |
| "start": 425.64, | |
| "duration": 3.15 | |
| }, | |
| { | |
| "text": "these ways to interact with a database.", | |
| "start": 428.79, | |
| "duration": 2.11 | |
| }, | |
| { | |
| "text": "And this is, again,\na nonexhaustive list.", | |
| "start": 430.9, | |
| "duration": 2.54 | |
| }, | |
| { | |
| "text": "Now, if you are a\ndatabase administrator,", | |
| "start": 433.44, | |
| "duration": 2.82 | |
| }, | |
| { | |
| "text": "or maybe you're somebody who's making\na choice of which software to use,", | |
| "start": 436.26, | |
| "duration": 3.15 | |
| }, | |
| { | |
| "text": "you have a few trade-offs to consider.", | |
| "start": 439.41, | |
| "duration": 2.14 | |
| }, | |
| { | |
| "text": "Let's say you might think of one being\nproprietary, for instance, costing", | |
| "start": 441.55, | |
| "duration": 3.77 | |
| }, | |
| { | |
| "text": "money to work with.", | |
| "start": 445.32, | |
| "duration": 1.41 | |
| }, | |
| { | |
| "text": "What you get for that\nmoney is additional support", | |
| "start": 446.73, | |
| "duration": 2.52 | |
| }, | |
| { | |
| "text": "to actually implement your own database.", | |
| "start": 449.25, | |
| "duration": 2.7 | |
| }, | |
| { | |
| "text": "On the other hand, you might have\nopen source software or free software", | |
| "start": 451.95, | |
| "duration": 3.66 | |
| }, | |
| { | |
| "text": "to use, stuff like\nPostgreSQL, MySQL, and SQLite.", | |
| "start": 455.61, | |
| "duration": 3.6 | |
| }, | |
| { | |
| "text": "But the downside is you are then\nresponsible for actually implementing", | |
| "start": 459.21, | |
| "duration": 4.29 | |
| }, | |
| { | |
| "text": "that database.", | |
| "start": 463.5, | |
| "duration": 2.17 | |
| }, | |
| { | |
| "text": "Another thing to consider\ntoo is that maybe some", | |
| "start": 465.67, | |
| "duration": 3.29 | |
| }, | |
| { | |
| "text": "are going to be heavier weight\nthan others, more fully featured", | |
| "start": 468.96, | |
| "duration": 3.39 | |
| }, | |
| { | |
| "text": "as a consequence but perhaps\nheavier weight requiring", | |
| "start": 472.35, | |
| "duration": 2.34 | |
| }, | |
| { | |
| "text": "more computation to run.", | |
| "start": 474.69, | |
| "duration": 1.83 | |
| }, | |
| { | |
| "text": "You can think of those\nlike MySQL or PostgreSQL", | |
| "start": 476.52, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "being a little bit heavier weight\nbut being more fully featured,", | |
| "start": 478.83, | |
| "duration": 3.78 | |
| }, | |
| { | |
| "text": "whereas SQLite down below will be a\nlittle lighter weight, as the name", | |
| "start": 482.61, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "might imply, but allow you\nto do most of the same work", | |
| "start": 486.24, | |
| "duration": 3.54 | |
| }, | |
| { | |
| "text": "that these other softwares\ncould allow you to do as well.", | |
| "start": 489.78, | |
| "duration": 3.55 | |
| }, | |
| { | |
| "text": "And in this course, we'll\nactually be using SQLite for you", | |
| "start": 493.33, | |
| "duration": 3.08 | |
| }, | |
| { | |
| "text": "to work with your own databases.", | |
| "start": 496.41, | |
| "duration": 1.74 | |
| }, | |
| { | |
| "text": "But gradually, we'll move on\nto MySQL and PostgreSQL too.", | |
| "start": 498.15, | |
| "duration": 6.25 | |
| }, | |
| { | |
| "text": "So let me go ahead and talk\nabout then SQL in this case.", | |
| "start": 504.4, | |
| "duration": 4.78 | |
| }, | |
| { | |
| "text": "You might notice that in each of\nthese, MySQL and PostgreSQL and SQLite,", | |
| "start": 509.18, | |
| "duration": 4.85 | |
| }, | |
| { | |
| "text": "each of them have this\nidea of SQL in them.", | |
| "start": 514.03, | |
| "duration": 2.759 | |
| }, | |
| { | |
| "text": "And SQL is that language that we'll\nuse to interact with our database.", | |
| "start": 516.789, | |
| "duration": 3.961 | |
| }, | |
| { | |
| "text": "Now, let me ask, what does\nSQL stand for, perhaps?", | |
| "start": 520.75, | |
| "duration": 4.38 | |
| }, | |
| { | |
| "text": "We talk about S-Q-L or SQL,\nbut what might SQL stand for?", | |
| "start": 525.13, | |
| "duration": 6.13 | |
| }, | |
| { | |
| "text": "So I'm saying it stands for\nStructured Query Language,", | |
| "start": 531.26, | |
| "duration": 2.61 | |
| }, | |
| { | |
| "text": "which is good if you already know\nthis, but not to worry if you don't.", | |
| "start": 533.87, | |
| "duration": 2.917 | |
| }, | |
| { | |
| "text": "So SQL does stand for\nStructured Query Language.", | |
| "start": 536.787, | |
| "duration": 3.413 | |
| }, | |
| { | |
| "text": "As we'll see in this\ncourse, it is structured.", | |
| "start": 540.2, | |
| "duration": 2.59 | |
| }, | |
| { | |
| "text": "It does have some keywords you can\nuse to interact with the database.", | |
| "start": 542.79, | |
| "duration": 2.93 | |
| }, | |
| { | |
| "text": "And it is a query language--\nit can be used to ask", | |
| "start": 545.72, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "questions of data inside a database.", | |
| "start": 548.81, | |
| "duration": 4.3 | |
| }, | |
| { | |
| "text": "We'll see that this is the language we\ncan use to create data, to read data,", | |
| "start": 553.11, | |
| "duration": 5.33 | |
| }, | |
| { | |
| "text": "to update data, and delete\ndata all with SQL in this case.", | |
| "start": 558.44, | |
| "duration": 5.92 | |
| }, | |
| { | |
| "text": "And our next thing will be to\ntalk about this idea of querying.", | |
| "start": 564.36, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "So SQL is a query language,\nbut what can we do with SQL?", | |
| "start": 568.35, | |
| "duration": 4.48 | |
| }, | |
| { | |
| "text": "Well, the first thing we\ncan do, we'll focus on first", | |
| "start": 572.83, | |
| "duration": 2.32 | |
| }, | |
| { | |
| "text": "in this course is writing queries--", | |
| "start": 575.15, | |
| "duration": 2.16 | |
| }, | |
| { | |
| "text": "trying to ask questions\nof data using SQL.", | |
| "start": 577.31, | |
| "duration": 3.96 | |
| }, | |
| { | |
| "text": "Well, what kinds of\nquestions could we ask?", | |
| "start": 581.27, | |
| "duration": 2.46 | |
| }, | |
| { | |
| "text": "Well, you might imagine perhaps working\nat an Instagram or a Facebook trying", | |
| "start": 583.73, | |
| "duration": 4.59 | |
| }, | |
| { | |
| "text": "to work as an engineer to\nfigure out what kinds of posts", | |
| "start": 588.32, | |
| "duration": 2.97 | |
| }, | |
| { | |
| "text": "are the most liked on your platform.", | |
| "start": 591.29, | |
| "duration": 1.99 | |
| }, | |
| { | |
| "text": "That's a question you can answer\nwith databases and with SQL.", | |
| "start": 593.28, | |
| "duration": 3.77 | |
| }, | |
| { | |
| "text": "You might also think of whether\nyour numbers of daily users", | |
| "start": 597.05, | |
| "duration": 3.45 | |
| }, | |
| { | |
| "text": "are growing or shrinking if you\nwork at a startup for instance.", | |
| "start": 600.5, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "Even maybe you might be working for some\na company like Spotify that could ask,", | |
| "start": 603.59, | |
| "duration": 3.94 | |
| }, | |
| { | |
| "text": "how could we play songs that are\nlike those a user just played?", | |
| "start": 607.53, | |
| "duration": 4.04 | |
| }, | |
| { | |
| "text": "This too is a question you can\nanswer with databases and with SQL.", | |
| "start": 611.57, | |
| "duration": 6.12 | |
| }, | |
| { | |
| "text": "Now today, we'll be focusing\non this database of books.", | |
| "start": 617.69, | |
| "duration": 3.75 | |
| }, | |
| { | |
| "text": "And in particular, books\nthat have been longlisted,", | |
| "start": 621.44, | |
| "duration": 3.06 | |
| }, | |
| { | |
| "text": "quote, unquote, \"for the\nInternational Booker Prize.\"", | |
| "start": 624.5, | |
| "duration": 3.028 | |
| }, | |
| { | |
| "text": "The International Booker\nPrize, if you're not familiar,", | |
| "start": 627.528, | |
| "duration": 2.292 | |
| }, | |
| { | |
| "text": "is an award given to books\nwritten around the world", | |
| "start": 629.82, | |
| "duration": 2.75 | |
| }, | |
| { | |
| "text": "by authors from many countries.", | |
| "start": 632.57, | |
| "duration": 1.68 | |
| }, | |
| { | |
| "text": "And it's designed to award books\nof fiction particularly good", | |
| "start": 634.25, | |
| "duration": 4.35 | |
| }, | |
| { | |
| "text": "in some cases.", | |
| "start": 638.6, | |
| "duration": 0.9 | |
| }, | |
| { | |
| "text": "And every year, the\ncommittee selects 13 books", | |
| "start": 639.5, | |
| "duration": 3.54 | |
| }, | |
| { | |
| "text": "to include on a longlist for\nconsideration for this prize.", | |
| "start": 643.04, | |
| "duration": 4.32 | |
| }, | |
| { | |
| "text": "And our database then has\nfive years worth of longlists", | |
| "start": 647.36, | |
| "duration": 3.6 | |
| }, | |
| { | |
| "text": "for the International\nBooker Prize inside of it.", | |
| "start": 650.96, | |
| "duration": 2.91 | |
| }, | |
| { | |
| "text": "We could use this\ndatabase, perhaps, if we", | |
| "start": 653.87, | |
| "duration": 1.86 | |
| }, | |
| { | |
| "text": "were a librarian trying to find books\nfor our library or even as a book", | |
| "start": 655.73, | |
| "duration": 4.95 | |
| }, | |
| { | |
| "text": "reader, an avid reader myself\ntrying to find books to read that I", | |
| "start": 660.68, | |
| "duration": 2.94 | |
| }, | |
| { | |
| "text": "could put on my own shelf overall.", | |
| "start": 663.62, | |
| "duration": 2.8 | |
| }, | |
| { | |
| "text": "So we'll look at this database.", | |
| "start": 666.42, | |
| "duration": 2.13 | |
| }, | |
| { | |
| "text": "But we'll need a few\ntools in our toolkit,", | |
| "start": 668.55, | |
| "duration": 2.03 | |
| }, | |
| { | |
| "text": "metaphorically, to actually\ninteract with this database.", | |
| "start": 670.58, | |
| "duration": 3.07 | |
| }, | |
| { | |
| "text": "And one of them is going\nto be Visual Studio Code.", | |
| "start": 673.65, | |
| "duration": 3.86 | |
| }, | |
| { | |
| "text": "Visual Studio code is an IDE, integrated\ndevelopment environment, to write code", | |
| "start": 677.51, | |
| "duration": 4.95 | |
| }, | |
| { | |
| "text": "and to edit files with.", | |
| "start": 682.46, | |
| "duration": 1.56 | |
| }, | |
| { | |
| "text": "It's also often called VS Code.", | |
| "start": 684.02, | |
| "duration": 3.35 | |
| }, | |
| { | |
| "text": "Now, in VS Code, we'll also be able to\nuse SQLite, this database management", | |
| "start": 687.37, | |
| "duration": 5.33 | |
| }, | |
| { | |
| "text": "system, or a DBMS for short, to\nactually interact with that database.", | |
| "start": 692.7, | |
| "duration": 4.9 | |
| }, | |
| { | |
| "text": "So we'll be using these\ntwo tools combined", | |
| "start": 697.6, | |
| "duration": 2.18 | |
| }, | |
| { | |
| "text": "to work with the database of longlisted\nbooks for the International Booker", | |
| "start": 699.78, | |
| "duration": 4.32 | |
| }, | |
| { | |
| "text": "Prize.", | |
| "start": 704.1, | |
| "duration": 1.42 | |
| }, | |
| { | |
| "text": "And although we'll be using it here,\nSQLite is not just used in this course.", | |
| "start": 705.52, | |
| "duration": 4.02 | |
| }, | |
| { | |
| "text": "It's used in a variety of applications.", | |
| "start": 709.54, | |
| "duration": 2.4 | |
| }, | |
| { | |
| "text": "You could think too\nof phone applications,", | |
| "start": 711.94, | |
| "duration": 2.16 | |
| }, | |
| { | |
| "text": "where SQLite is often used on those\ndevices have much lower memory.", | |
| "start": 714.1, | |
| "duration": 4.44 | |
| }, | |
| { | |
| "text": "You could think too of it being\nused on desktop applications", | |
| "start": 718.54, | |
| "duration": 3.6 | |
| }, | |
| { | |
| "text": "to simplify the process\nof storing data there too.", | |
| "start": 722.14, | |
| "duration": 3.18 | |
| }, | |
| { | |
| "text": "You could even think of\nit being used on websites", | |
| "start": 725.32, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "to help store information that user\nsubmits via a form, for example.", | |
| "start": 727.99, | |
| "duration": 4.9 | |
| }, | |
| { | |
| "text": "So we'll jump into using\nSQLite, but keep in mind", | |
| "start": 732.89, | |
| "duration": 2.87 | |
| }, | |
| { | |
| "text": "that not just in this\ncourse you'll use it,", | |
| "start": 735.76, | |
| "duration": 2.58 | |
| }, | |
| { | |
| "text": "but also, it's used in a variety\nof applications here too.", | |
| "start": 738.34, | |
| "duration": 4.84 | |
| }, | |
| { | |
| "text": "So why don't we just jump right into\nthings and start using our environment", | |
| "start": 743.18, | |
| "duration": 4.35 | |
| }, | |
| { | |
| "text": "and start using SQLite?", | |
| "start": 747.53, | |
| "duration": 1.32 | |
| }, | |
| { | |
| "text": "So I'll go over here to my computer\nand will open up, let's say, VS Code.", | |
| "start": 748.85, | |
| "duration": 5.64 | |
| }, | |
| { | |
| "text": "We're here.", | |
| "start": 754.49, | |
| "duration": 0.84 | |
| }, | |
| { | |
| "text": "You can see I have my\nterminal environment.", | |
| "start": 755.33, | |
| "duration": 2.4 | |
| }, | |
| { | |
| "text": "And if you're familiar,\nyou can type things like ls", | |
| "start": 757.73, | |
| "duration": 2.46 | |
| }, | |
| { | |
| "text": "to see the files that are\nin your current folder.", | |
| "start": 760.19, | |
| "duration": 2.92 | |
| }, | |
| { | |
| "text": "So I'll type ls right here.", | |
| "start": 763.11, | |
| "duration": 1.7 | |
| }, | |
| { | |
| "text": "And I'll see this database\ncalled longlist.db.", | |
| "start": 764.81, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "Again, working with books that\nhave been longlisted or considered", | |
| "start": 768.8, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "for the International Booker Prize.", | |
| "start": 772.37, | |
| "duration": 2.55 | |
| }, | |
| { | |
| "text": "So if I want to open up this\nfile, I can use this command.", | |
| "start": 774.92, | |
| "duration": 5.46 | |
| }, | |
| { | |
| "text": "Then this command is going\nto be called SQLite 3.", | |
| "start": 780.38, | |
| "duration": 4.53 | |
| }, | |
| { | |
| "text": "Or I can take some file that I\nhave, like longlist.db, and open", | |
| "start": 784.91, | |
| "duration": 4.68 | |
| }, | |
| { | |
| "text": "it using this program called SQLite 3.", | |
| "start": 789.59, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "Well, it's called SQLite 3 because\nthis is the third version of the SQLite", | |
| "start": 792.68, | |
| "duration": 4.02 | |
| }, | |
| { | |
| "text": "software.", | |
| "start": 796.7, | |
| "duration": 1.17 | |
| }, | |
| { | |
| "text": "So let's try this in our terminal.", | |
| "start": 797.87, | |
| "duration": 2.49 | |
| }, | |
| { | |
| "text": "I'll go back over here, and\nI'll say sqlite3 longlist.db.", | |
| "start": 800.36, | |
| "duration": 6.75 | |
| }, | |
| { | |
| "text": "And now, I'll hit Enter.", | |
| "start": 807.11, | |
| "duration": 2.07 | |
| }, | |
| { | |
| "text": "And notice how my\nterminal prompt changes.", | |
| "start": 809.18, | |
| "duration": 2.83 | |
| }, | |
| { | |
| "text": "It's no longer dollar sign.", | |
| "start": 812.01, | |
| "duration": 1.46 | |
| }, | |
| { | |
| "text": "It now says sqlite in front.", | |
| "start": 813.47, | |
| "duration": 2.49 | |
| }, | |
| { | |
| "text": "This means I'm inside of\nmy SQLite environment.", | |
| "start": 815.96, | |
| "duration": 3.88 | |
| }, | |
| { | |
| "text": "So to clear things up, let\nme just clear my terminal.", | |
| "start": 819.84, | |
| "duration": 3.06 | |
| }, | |
| { | |
| "text": "I can use Control-L for this.", | |
| "start": 822.9, | |
| "duration": 1.88 | |
| }, | |
| { | |
| "text": "And now I have just that prompt up top.", | |
| "start": 824.78, | |
| "duration": 3.27 | |
| }, | |
| { | |
| "text": "And now a question I want to\nanswer in this case first is, what", | |
| "start": 828.05, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "data do I actually have in my database?", | |
| "start": 832.04, | |
| "duration": 3.48 | |
| }, | |
| { | |
| "text": "What data is actually here for me to\nlook at and to ask questions about?", | |
| "start": 835.52, | |
| "duration": 5.13 | |
| }, | |
| { | |
| "text": "Now, for this question, I\ncan use my very first SQL", | |
| "start": 840.65, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "keyword, which will be called SELECT.", | |
| "start": 844.52, | |
| "duration": 2.58 | |
| }, | |
| { | |
| "text": "So SELECT is a way for me to select some\nrows in a table inside of my database.", | |
| "start": 847.1, | |
| "duration": 6.27 | |
| }, | |
| { | |
| "text": "Using SELECT, I can\nget back certain rows", | |
| "start": 853.37, | |
| "duration": 2.52 | |
| }, | |
| { | |
| "text": "or, in this case, perhaps all of them\njust to get a taste of what's inside.", | |
| "start": 855.89, | |
| "duration": 4.12 | |
| }, | |
| { | |
| "text": "So let's try using SELECT on\nthis database to understand", | |
| "start": 860.01, | |
| "duration": 3.2 | |
| }, | |
| { | |
| "text": "what rows we have in our table here.", | |
| "start": 863.21, | |
| "duration": 3.34 | |
| }, | |
| { | |
| "text": "Let me go back to my computer\nand to my SQLite environment.", | |
| "start": 866.55, | |
| "duration": 3.89 | |
| }, | |
| { | |
| "text": "And I will try this\nvery first SQL keyword.", | |
| "start": 870.44, | |
| "duration": 3.48 | |
| }, | |
| { | |
| "text": "I'll say SELECT.", | |
| "start": 873.92, | |
| "duration": 1.77 | |
| }, | |
| { | |
| "text": "And I can use this star operator\nhere to say select everything.", | |
| "start": 875.69, | |
| "duration": 4.29 | |
| }, | |
| { | |
| "text": "I want every row and every\ncolumn from this table.", | |
| "start": 879.98, | |
| "duration": 5.07 | |
| }, | |
| { | |
| "text": "Now, it's not enough for me to simply\nsay select star and end my query.", | |
| "start": 885.05, | |
| "duration": 4.89 | |
| }, | |
| { | |
| "text": "I had to tell SQL which table\ndo I want to select rows from.", | |
| "start": 889.94, | |
| "duration": 4.2 | |
| }, | |
| { | |
| "text": "In this case, I know I\ntable was called longlist.", | |
| "start": 894.14, | |
| "duration": 3.12 | |
| }, | |
| { | |
| "text": "So I'll say SELECT star from\n\"longlist,\" quote, unquote.", | |
| "start": 897.26, | |
| "duration": 5.25 | |
| }, | |
| { | |
| "text": "And to end my query, I'll say Semicolon.", | |
| "start": 902.51, | |
| "duration": 3.93 | |
| }, | |
| { | |
| "text": "And then finally, I can hit Enter.", | |
| "start": 906.44, | |
| "duration": 2.79 | |
| }, | |
| { | |
| "text": "And notice how I get a lot of data back.", | |
| "start": 909.23, | |
| "duration": 2.46 | |
| }, | |
| { | |
| "text": "This is a lot of data all at once.", | |
| "start": 911.69, | |
| "duration": 1.595 | |
| }, | |
| { | |
| "text": "But it's because my terminal\nis a little bit small,", | |
| "start": 913.285, | |
| "duration": 2.125 | |
| }, | |
| { | |
| "text": "there's a lot of rows and columns here.", | |
| "start": 915.41, | |
| "duration": 1.84 | |
| }, | |
| { | |
| "text": "So I could probably simplify\nthis just a little bit.", | |
| "start": 917.25, | |
| "duration": 3.17 | |
| }, | |
| { | |
| "text": "And instead of saying SELECT star, I\ncould also select a particular column", | |
| "start": 920.42, | |
| "duration": 4.32 | |
| }, | |
| { | |
| "text": "from my table.", | |
| "start": 924.74, | |
| "duration": 1.65 | |
| }, | |
| { | |
| "text": "I could say, for instance,\nSELECT, let's say,", | |
| "start": 926.39, | |
| "duration": 2.97 | |
| }, | |
| { | |
| "text": "just the title column from my\ndatabase for my table like this.", | |
| "start": 929.36, | |
| "duration": 5.74 | |
| }, | |
| { | |
| "text": "I just know already that there\nis a column called title.", | |
| "start": 935.1, | |
| "duration": 4.07 | |
| }, | |
| { | |
| "text": "So now, I'll try this instead-- not\nselect star, but select title instead.", | |
| "start": 939.17, | |
| "duration": 4.2 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 943.37, | |
| "duration": 1.02 | |
| }, | |
| { | |
| "text": "And now, this looks a little bit better.", | |
| "start": 944.39, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "I can see the titles inside of\nthis table from top to bottom.", | |
| "start": 946.64, | |
| "duration": 7.33 | |
| }, | |
| { | |
| "text": "Now, the neat thing here is I can\nselect more than one column too.", | |
| "start": 953.97, | |
| "duration": 4.215 | |
| }, | |
| { | |
| "text": "Let's say I don't want just the title--", | |
| "start": 958.185, | |
| "duration": 1.625 | |
| }, | |
| { | |
| "text": "I want titles and authors in my search.", | |
| "start": 959.81, | |
| "duration": 2.55 | |
| }, | |
| { | |
| "text": "Well, I could do that as well.", | |
| "start": 962.36, | |
| "duration": 1.9 | |
| }, | |
| { | |
| "text": "Let me try this.", | |
| "start": 964.26, | |
| "duration": 0.89 | |
| }, | |
| { | |
| "text": "SELECT not just \"title,\"\nquote, unquote, but then I'll", | |
| "start": 965.15, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "say comma and some new column to select.", | |
| "start": 969.02, | |
| "duration": 3.72 | |
| }, | |
| { | |
| "text": "I'll select also the\nauthors from this table.", | |
| "start": 972.74, | |
| "duration": 3.96 | |
| }, | |
| { | |
| "text": "And I'll select them from\nthe longlist table like this.", | |
| "start": 976.7, | |
| "duration": 3.81 | |
| }, | |
| { | |
| "text": "Now I'll hit Semicolon to end my query.", | |
| "start": 980.51, | |
| "duration": 2.34 | |
| }, | |
| { | |
| "text": "Hit Enter.", | |
| "start": 982.85, | |
| "duration": 1.11 | |
| }, | |
| { | |
| "text": "And now I'll see a\nvariety of columns here,", | |
| "start": 983.96, | |
| "duration": 3.3 | |
| }, | |
| { | |
| "text": "in particular the title\nand the author column.", | |
| "start": 987.26, | |
| "duration": 4.19 | |
| }, | |
| { | |
| "text": "Now, this is going to be like\nall of my columns so far.", | |
| "start": 991.45, | |
| "duration": 2.733 | |
| }, | |
| { | |
| "text": "And there is a way for me to\nget back just to some of them", | |
| "start": 994.183, | |
| "duration": 2.417 | |
| }, | |
| { | |
| "text": "later on that we'll see.", | |
| "start": 996.6, | |
| "duration": 1.32 | |
| }, | |
| { | |
| "text": "But for now, let's\nask, what questions do", | |
| "start": 997.92, | |
| "duration": 2.64 | |
| }, | |
| { | |
| "text": "you have on this SQL SELECT statement\nand how we're getting back these rows?", | |
| "start": 1000.56, | |
| "duration": 6.62 | |
| }, | |
| { | |
| "text": "SPEAKER: Do I need to use the quotes\naround the words like you are?", | |
| "start": 1007.18, | |
| "duration": 3.532 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah, great question.", | |
| "start": 1010.712, | |
| "duration": 1.458 | |
| }, | |
| { | |
| "text": "Do I have to use quotes\naround the words like I am?", | |
| "start": 1012.17, | |
| "duration": 2.96 | |
| }, | |
| { | |
| "text": "In general, it's a good practice to use\nthese double quotes around your table", | |
| "start": 1015.13, | |
| "duration": 4.44 | |
| }, | |
| { | |
| "text": "names and your column names.", | |
| "start": 1019.57, | |
| "duration": 1.86 | |
| }, | |
| { | |
| "text": "These are called SQL identifiers.", | |
| "start": 1021.43, | |
| "duration": 2.49 | |
| }, | |
| { | |
| "text": "Later on, we'll see we'll also\nhave strings in SQL-- strings", | |
| "start": 1023.92, | |
| "duration": 4.26 | |
| }, | |
| { | |
| "text": "being collections of\ncharacters we can use.", | |
| "start": 1028.18, | |
| "duration": 1.86 | |
| }, | |
| { | |
| "text": "For those, we'll simply\nsingle-quote them", | |
| "start": 1030.04, | |
| "duration": 2.279 | |
| }, | |
| { | |
| "text": "to note the difference between a\nstring and an actual column name.", | |
| "start": 1032.319, | |
| "duration": 4.121 | |
| }, | |
| { | |
| "text": "So good style convention here to\nuse-- double quotes for column names", | |
| "start": 1036.44, | |
| "duration": 3.53 | |
| }, | |
| { | |
| "text": "and single quotes for string names.", | |
| "start": 1039.97, | |
| "duration": 3.33 | |
| }, | |
| { | |
| "text": "Other questions too?", | |
| "start": 1043.3, | |
| "duration": 1.89 | |
| }, | |
| { | |
| "text": "SPEAKER: OK.", | |
| "start": 1045.19, | |
| "duration": 0.55 | |
| }, | |
| { | |
| "text": "I wanted to know, where did we\ntake all this information from.", | |
| "start": 1045.74, | |
| "duration": 4.25 | |
| }, | |
| { | |
| "text": "Like, this data, I don't\nknow this list of books,", | |
| "start": 1049.99, | |
| "duration": 4.35 | |
| }, | |
| { | |
| "text": "where did we take all\nthis information from?", | |
| "start": 1054.34, | |
| "duration": 2.298 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah, a great question.", | |
| "start": 1056.638, | |
| "duration": 1.542 | |
| }, | |
| { | |
| "text": "Where do we take this information from?", | |
| "start": 1058.18, | |
| "duration": 1.81 | |
| }, | |
| { | |
| "text": "So some of this data\nis publicly available.", | |
| "start": 1059.99, | |
| "duration": 2.28 | |
| }, | |
| { | |
| "text": "In fact, if you look at\nthe Booker Prize website,", | |
| "start": 1062.27, | |
| "duration": 2.42 | |
| }, | |
| { | |
| "text": "you can find a set of\nlonglisted books over the years.", | |
| "start": 1064.69, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "In this case, we have\nbooks from 2018 to 2023.", | |
| "start": 1067.78, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "We'll also see later on this table\nhas data on the ratings of those books", | |
| "start": 1071.65, | |
| "duration": 5.238 | |
| }, | |
| { | |
| "text": "and the number of votes that\nwere given to those books.", | |
| "start": 1076.888, | |
| "duration": 2.292 | |
| }, | |
| { | |
| "text": "That data is from Goodreads,\nthe site that aggregates", | |
| "start": 1079.18, | |
| "duration": 3.45 | |
| }, | |
| { | |
| "text": "reviews from people like you, people\nlike me who rate books online.", | |
| "start": 1082.63, | |
| "duration": 4.3 | |
| }, | |
| { | |
| "text": "So we've taken data from a variety of\nsources and combined it into one here.", | |
| "start": 1086.93, | |
| "duration": 4.45 | |
| }, | |
| { | |
| "text": "Let's take one more\nquestion to from Vinayak.", | |
| "start": 1091.38, | |
| "duration": 3.117 | |
| }, | |
| { | |
| "text": "SPEAKER: Yeah.", | |
| "start": 1094.497, | |
| "duration": 0.583 | |
| }, | |
| { | |
| "text": "So I wanted to ask regarding the syntax\nof what you used in the terminal.", | |
| "start": 1095.08, | |
| "duration": 5.26 | |
| }, | |
| { | |
| "text": "So is the whole SQLite\n3 is case-sensitive", | |
| "start": 1100.34, | |
| "duration": 4.49 | |
| }, | |
| { | |
| "text": "because while using the syntax you\nused capital letters, whereas can we", | |
| "start": 1104.83, | |
| "duration": 5.19 | |
| }, | |
| { | |
| "text": "use small-case letters as well?", | |
| "start": 1110.02, | |
| "duration": 2.548 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: A great question.", | |
| "start": 1112.568, | |
| "duration": 1.292 | |
| }, | |
| { | |
| "text": "So here, I used capital\nletters for SQL keywords", | |
| "start": 1113.86, | |
| "duration": 2.72 | |
| }, | |
| { | |
| "text": "and lowercase, my table\nnames and column names.", | |
| "start": 1116.58, | |
| "duration": 2.7 | |
| }, | |
| { | |
| "text": "Do I have to do that?", | |
| "start": 1119.28, | |
| "duration": 1.53 | |
| }, | |
| { | |
| "text": "I, in some cases, do, some cases don't.", | |
| "start": 1120.81, | |
| "duration": 2.4 | |
| }, | |
| { | |
| "text": "I think I could use lowercase\nfor these SQL keywords,", | |
| "start": 1123.21, | |
| "duration": 3.18 | |
| }, | |
| { | |
| "text": "but it's not very good\nstyle, for instance.", | |
| "start": 1126.39, | |
| "duration": 2.47 | |
| }, | |
| { | |
| "text": "So let me just show you an example of\nthis while I go back to my computer.", | |
| "start": 1128.86, | |
| "duration": 3.6 | |
| }, | |
| { | |
| "text": "So the question again was, can I\nuse lowercase for SQL keywords?", | |
| "start": 1132.46, | |
| "duration": 5.09 | |
| }, | |
| { | |
| "text": "I think I could, but the\nquestion is, should I?", | |
| "start": 1137.55, | |
| "duration": 3.3 | |
| }, | |
| { | |
| "text": "And probably not.", | |
| "start": 1140.85, | |
| "duration": 0.768 | |
| }, | |
| { | |
| "text": "So let me try this.", | |
| "start": 1141.618, | |
| "duration": 0.792 | |
| }, | |
| { | |
| "text": "I'll say select, let's say, title from--", | |
| "start": 1142.41, | |
| "duration": 3.035 | |
| }, | |
| { | |
| "text": "I'm in the habit of uppercase it.", | |
| "start": 1145.445, | |
| "duration": 1.375 | |
| }, | |
| { | |
| "text": "So I'll say from in lowercase\nlonglist like this Semicolon.", | |
| "start": 1146.82, | |
| "duration": 4.83 | |
| }, | |
| { | |
| "text": "Hit Enter.", | |
| "start": 1151.65, | |
| "duration": 0.96 | |
| }, | |
| { | |
| "text": "And that still works.", | |
| "start": 1152.61, | |
| "duration": 1.86 | |
| }, | |
| { | |
| "text": "But the problem you\nmight run into is someone", | |
| "start": 1154.47, | |
| "duration": 2.64 | |
| }, | |
| { | |
| "text": "who's reading your query particularly,\na long one, might want to know,", | |
| "start": 1157.11, | |
| "duration": 4.05 | |
| }, | |
| { | |
| "text": "what are the SQL keywords?", | |
| "start": 1161.16, | |
| "duration": 1.65 | |
| }, | |
| { | |
| "text": "And what are your column names\nand other identifiers here?", | |
| "start": 1162.81, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "By capitalizing your SQL\nkeywords, you can make it clear", | |
| "start": 1166.38, | |
| "duration": 3.03 | |
| }, | |
| { | |
| "text": "that this is a SQL keyword and\nnot some other name overall.", | |
| "start": 1169.41, | |
| "duration": 5.87 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 1175.28, | |
| "duration": 0.6 | |
| }, | |
| { | |
| "text": "So let's keep going.", | |
| "start": 1175.88, | |
| "duration": 1.14 | |
| }, | |
| { | |
| "text": "And we saw just a little bit ago that\nwe could select \"title\" from \"longlist.\"", | |
| "start": 1177.02, | |
| "duration": 4.77 | |
| }, | |
| { | |
| "text": "And we would get back a whole list of\ntitles, literally all the titles that", | |
| "start": 1181.79, | |
| "duration": 4.56 | |
| }, | |
| { | |
| "text": "are in this database.", | |
| "start": 1186.35, | |
| "duration": 2.05 | |
| }, | |
| { | |
| "text": "But it's often maybe good practice\nfor me to not look at all the data.", | |
| "start": 1188.4, | |
| "duration": 4.7 | |
| }, | |
| { | |
| "text": "Like, imagine if we had\nmillions of rows in this column,", | |
| "start": 1193.1, | |
| "duration": 3.33 | |
| }, | |
| { | |
| "text": "but only to give back some.", | |
| "start": 1196.43, | |
| "duration": 1.56 | |
| }, | |
| { | |
| "text": "Take a peek of what's\ninside this database.", | |
| "start": 1197.99, | |
| "duration": 2.7 | |
| }, | |
| { | |
| "text": "And for that, I could use this other\nSQL keyword, this one called LIMIT.", | |
| "start": 1200.69, | |
| "duration": 5.13 | |
| }, | |
| { | |
| "text": "So LIMIT, as its name\nmight imply, limits", | |
| "start": 1205.82, | |
| "duration": 3.3 | |
| }, | |
| { | |
| "text": "the number of queries or the number\nof rows I get back from my query.", | |
| "start": 1209.12, | |
| "duration": 3.93 | |
| }, | |
| { | |
| "text": "I could say LIMIT 3,\nfor instance, or LIMIT 5", | |
| "start": 1213.05, | |
| "duration": 3.15 | |
| }, | |
| { | |
| "text": "to get back only the top 3 or\nthe top 5 rows from my table.", | |
| "start": 1216.2, | |
| "duration": 3.93 | |
| }, | |
| { | |
| "text": "And let me ask folks,\nif I wanted to peak", | |
| "start": 1220.13, | |
| "duration": 2.37 | |
| }, | |
| { | |
| "text": "in this data set, how many rows\nshould I try to limit it to?", | |
| "start": 1222.5, | |
| "duration": 5.39 | |
| }, | |
| { | |
| "text": "I could say SELECT\ntitle from, let's say,", | |
| "start": 1227.89, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "longlist, but limit to what number?", | |
| "start": 1230.2, | |
| "duration": 3.76 | |
| }, | |
| { | |
| "text": "I'm seeing 10.", | |
| "start": 1233.96, | |
| "duration": 1.14 | |
| }, | |
| { | |
| "text": "So let's try 10 first.", | |
| "start": 1235.1, | |
| "duration": 1.25 | |
| }, | |
| { | |
| "text": "I'll go back to my computer.", | |
| "start": 1236.35, | |
| "duration": 1.83 | |
| }, | |
| { | |
| "text": "I'll come back over here,\nand I'll say, why don't I", | |
| "start": 1238.18, | |
| "duration": 2.43 | |
| }, | |
| { | |
| "text": "select \"title\" from \"longlist?\"", | |
| "start": 1240.61, | |
| "duration": 5.09 | |
| }, | |
| { | |
| "text": "But now, instead of hitting Semicolon,\nI will instead say LIMIT 10 Semicolon.", | |
| "start": 1245.7, | |
| "duration": 7.98 | |
| }, | |
| { | |
| "text": "And I'll hit Enter.", | |
| "start": 1253.68, | |
| "duration": 1.29 | |
| }, | |
| { | |
| "text": "Now I see only the first\n10 rows in my data set.", | |
| "start": 1254.97, | |
| "duration": 5.04 | |
| }, | |
| { | |
| "text": "Handy for peeking in at the\ntop of my data set here too.", | |
| "start": 1260.01, | |
| "duration": 3.37 | |
| }, | |
| { | |
| "text": "Let me try not just 10 but 5.", | |
| "start": 1263.38, | |
| "duration": 1.83 | |
| }, | |
| { | |
| "text": "So I'll say SELECT \"title\" from\n\"longlist\" LIMIT 5 Semicolon.", | |
| "start": 1265.21, | |
| "duration": 8.7 | |
| }, | |
| { | |
| "text": "This then gives me just the\ntop 5 titles in my database.", | |
| "start": 1273.91, | |
| "duration": 5.465 | |
| }, | |
| { | |
| "text": "Just in whatever order they\nwere added to my table,", | |
| "start": 1279.375, | |
| "duration": 2.125 | |
| }, | |
| { | |
| "text": "I'll see them in that order here too.", | |
| "start": 1281.5, | |
| "duration": 4.3 | |
| }, | |
| { | |
| "text": "So using LIMIT, we can actually try\nto get back a certain number of rows.", | |
| "start": 1285.8, | |
| "duration": 5.32 | |
| }, | |
| { | |
| "text": "But this isn't quite that interesting.", | |
| "start": 1291.12, | |
| "duration": 2.625 | |
| }, | |
| { | |
| "text": "It's good for peaking in your data set.", | |
| "start": 1293.745, | |
| "duration": 1.625 | |
| }, | |
| { | |
| "text": "I think we've answered that\nquestion of, what data do we have?", | |
| "start": 1295.37, | |
| "duration": 2.83 | |
| }, | |
| { | |
| "text": "But let's say we want to\nmake more advanced queries.", | |
| "start": 1298.2, | |
| "duration": 2.75 | |
| }, | |
| { | |
| "text": "We want to find the books that were\nnominated in 2023 or perhaps books", | |
| "start": 1300.95, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "by a certain author.", | |
| "start": 1304.58, | |
| "duration": 1.23 | |
| }, | |
| { | |
| "text": "Well, for that, we could use this next\nSQL keyword, this one called WHERE.", | |
| "start": 1305.81, | |
| "duration": 4.92 | |
| }, | |
| { | |
| "text": "So WHERE allows me to get\nback not all rows, but only", | |
| "start": 1310.73, | |
| "duration": 6.15 | |
| }, | |
| { | |
| "text": "some rows where some condition is true.", | |
| "start": 1316.88, | |
| "duration": 4.09 | |
| }, | |
| { | |
| "text": "So WHERE is often combined\nwith other conditions", | |
| "start": 1320.97, | |
| "duration": 3.53 | |
| }, | |
| { | |
| "text": "to make sure I only get back some\nrows, where that condition is true.", | |
| "start": 1324.5, | |
| "duration": 5.23 | |
| }, | |
| { | |
| "text": "Let's try looking at\nthat in SQLite to get", | |
| "start": 1329.73, | |
| "duration": 2.12 | |
| }, | |
| { | |
| "text": "a feel for what it can do for us here.", | |
| "start": 1331.85, | |
| "duration": 2.32 | |
| }, | |
| { | |
| "text": "So I'll go back to my WHERE.", | |
| "start": 1334.17, | |
| "duration": 3.38 | |
| }, | |
| { | |
| "text": "And I will then go back to SQLite here.", | |
| "start": 1337.55, | |
| "duration": 3.06 | |
| }, | |
| { | |
| "text": "Hit Control-L to clear my terminal.", | |
| "start": 1340.61, | |
| "duration": 2.88 | |
| }, | |
| { | |
| "text": "And I'll then try this query.", | |
| "start": 1343.49, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "I'll say SELECT \"title.\"", | |
| "start": 1345.53, | |
| "duration": 3.27 | |
| }, | |
| { | |
| "text": "SELECT \"title.\"", | |
| "start": 1348.8, | |
| "duration": 0.99 | |
| }, | |
| { | |
| "text": "And why don't we also\nselect author along the way?", | |
| "start": 1349.79, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "Two columns here.", | |
| "start": 1352.46, | |
| "duration": 1.83 | |
| }, | |
| { | |
| "text": "And I'll select them\nfrom my longlist table.", | |
| "start": 1354.29, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "But I don't want all rows.", | |
| "start": 1357.38, | |
| "duration": 2.07 | |
| }, | |
| { | |
| "text": "I only want, let's say, those titles and\nauthors that were longlisted in 2023.", | |
| "start": 1359.45, | |
| "duration": 5.79 | |
| }, | |
| { | |
| "text": "So I'll do this.", | |
| "start": 1365.24, | |
| "duration": 1.02 | |
| }, | |
| { | |
| "text": "I'll say WHERE the \"year\"\ncolumn is equal to 2023.", | |
| "start": 1366.26, | |
| "duration": 6.81 | |
| }, | |
| { | |
| "text": "And notice here how 2023\nis not in quotes because it", | |
| "start": 1373.07, | |
| "duration": 3.81 | |
| }, | |
| { | |
| "text": "is an actual number, an integer.", | |
| "start": 1376.88, | |
| "duration": 2.23 | |
| }, | |
| { | |
| "text": "So I don't need to quote it like I would\na string some collection of characters", | |
| "start": 1379.11, | |
| "duration": 3.5 | |
| }, | |
| { | |
| "text": "or a table or column name.", | |
| "start": 1382.61, | |
| "duration": 3.1 | |
| }, | |
| { | |
| "text": "So I'll hit Enter here.", | |
| "start": 1385.71, | |
| "duration": 1.77 | |
| }, | |
| { | |
| "text": "And what do I see?", | |
| "start": 1387.48, | |
| "duration": 0.89 | |
| }, | |
| { | |
| "text": "Well, I see only those books\nthat were nominated in 2023.", | |
| "start": 1388.37, | |
| "duration": 4.5 | |
| }, | |
| { | |
| "text": "Let's try this again.", | |
| "start": 1392.87, | |
| "duration": 1.33 | |
| }, | |
| { | |
| "text": "I might try not just 2023--", | |
| "start": 1394.2, | |
| "duration": 2.93 | |
| }, | |
| { | |
| "text": "I might try 2022 like this.", | |
| "start": 1397.13, | |
| "duration": 3.39 | |
| }, | |
| { | |
| "text": "Hit Semicolon.", | |
| "start": 1400.52, | |
| "duration": 1.35 | |
| }, | |
| { | |
| "text": "Now, I'll see those\nbooks nominated in 2022.", | |
| "start": 1401.87, | |
| "duration": 3.51 | |
| }, | |
| { | |
| "text": "I could keep going.", | |
| "start": 1405.38, | |
| "duration": 1.12 | |
| }, | |
| { | |
| "text": "I could say why not 2022?", | |
| "start": 1406.5, | |
| "duration": 1.76 | |
| }, | |
| { | |
| "text": "Why not 2021?", | |
| "start": 1408.26, | |
| "duration": 1.56 | |
| }, | |
| { | |
| "text": "Now, I have all those\nbooks nominated in 2021.", | |
| "start": 1409.82, | |
| "duration": 4.63 | |
| }, | |
| { | |
| "text": "So this is handy.", | |
| "start": 1414.45, | |
| "duration": 2.59 | |
| }, | |
| { | |
| "text": "We can set things equal to or not\nequal to make some condition here.", | |
| "start": 1417.04, | |
| "duration": 3.89 | |
| }, | |
| { | |
| "text": "And we also have others we could use.", | |
| "start": 1420.93, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "We saw equals just now.", | |
| "start": 1422.97, | |
| "duration": 1.68 | |
| }, | |
| { | |
| "text": "But we similarly have not equals.", | |
| "start": 1424.65, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "And we have this kind of\nobscure operator down here.", | |
| "start": 1426.96, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "This one being also equivalent to not\nequals as we'll see in just a minute.", | |
| "start": 1430.17, | |
| "duration": 5.68 | |
| }, | |
| { | |
| "text": "But let me first ask\nnow, what questions do", | |
| "start": 1435.85, | |
| "duration": 2.27 | |
| }, | |
| { | |
| "text": "we have on how to use WHERE\nor using SELECT so far?", | |
| "start": 1438.12, | |
| "duration": 4.05 | |
| }, | |
| { | |
| "text": "SPEAKER: Why are the subsets of SQL?", | |
| "start": 1442.17, | |
| "duration": 2.59 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: A good question.", | |
| "start": 1444.76, | |
| "duration": 1.25 | |
| }, | |
| { | |
| "text": "Are there subsets of SQL?", | |
| "start": 1446.01, | |
| "duration": 1.72 | |
| }, | |
| { | |
| "text": "So there are.", | |
| "start": 1447.73, | |
| "duration": 1.43 | |
| }, | |
| { | |
| "text": "In fact, S-Q-L or SQL\nwas defined by the,", | |
| "start": 1449.16, | |
| "duration": 3.71 | |
| }, | |
| { | |
| "text": "I believe it's the ANSI,\nlike standard corporation.", | |
| "start": 1452.87, | |
| "duration": 2.14 | |
| }, | |
| { | |
| "text": "They have a whole set\nof the SQL language", | |
| "start": 1455.01, | |
| "duration": 2.28 | |
| }, | |
| { | |
| "text": "that is like the official version of it.", | |
| "start": 1457.29, | |
| "duration": 2.08 | |
| }, | |
| { | |
| "text": "You might be able to use\nsome subset of that version", | |
| "start": 1459.37, | |
| "duration": 2.87 | |
| }, | |
| { | |
| "text": "with the database manager\nsystem that you actually use.", | |
| "start": 1462.24, | |
| "duration": 2.5 | |
| }, | |
| { | |
| "text": "So for SQLite, we're using a subset\nof SQL that works with SQLite.", | |
| "start": 1464.74, | |
| "duration": 4.28 | |
| }, | |
| { | |
| "text": "Similarly, if you were using another\nsoftware like PostgreSQL or MySQL,", | |
| "start": 1469.02, | |
| "duration": 4.32 | |
| }, | |
| { | |
| "text": "you could use another subset there too.", | |
| "start": 1473.34, | |
| "duration": 3.43 | |
| }, | |
| { | |
| "text": "Let's take another question\nfrom Tayas, perhaps.", | |
| "start": 1476.77, | |
| "duration": 3.58 | |
| }, | |
| { | |
| "text": "SPEAKER: Then I want to know that, can\nwe add 2022 and 2021 in a terminal?", | |
| "start": 1480.35, | |
| "duration": 5.443 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah, good question.", | |
| "start": 1485.793, | |
| "duration": 1.417 | |
| }, | |
| { | |
| "text": "Could I, perhaps, try to\nfilter by 2021 and 2022?", | |
| "start": 1487.21, | |
| "duration": 5.67 | |
| }, | |
| { | |
| "text": "I could do that.", | |
| "start": 1492.88, | |
| "duration": 0.702 | |
| }, | |
| { | |
| "text": "And we'll see that in\njust a moment here.", | |
| "start": 1493.582, | |
| "duration": 1.708 | |
| }, | |
| { | |
| "text": "So let's keep going and exploring\nsome other options with not equals.", | |
| "start": 1495.29, | |
| "duration": 2.96 | |
| }, | |
| { | |
| "text": "And then we'll see how we can\ncombine conditions using WHERE too.", | |
| "start": 1498.25, | |
| "duration": 3.84 | |
| }, | |
| { | |
| "text": "So let's go back, and\nlet's focus first on trying", | |
| "start": 1502.09, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "to use these not equal operators.", | |
| "start": 1505.3, | |
| "duration": 2.43 | |
| }, | |
| { | |
| "text": "We saw the exclamation point equals and\nthis greater than, less than sign put", | |
| "start": 1507.73, | |
| "duration": 4.65 | |
| }, | |
| { | |
| "text": "together.", | |
| "start": 1512.38, | |
| "duration": 1.12 | |
| }, | |
| { | |
| "text": "So let's try a few of those.", | |
| "start": 1513.5, | |
| "duration": 1.68 | |
| }, | |
| { | |
| "text": "Let's say I want to find books that\nare written by a certain author.", | |
| "start": 1515.18, | |
| "duration": 4.89 | |
| }, | |
| { | |
| "text": "Well, I could use equals for that.", | |
| "start": 1520.07, | |
| "duration": 1.55 | |
| }, | |
| { | |
| "text": "But let's say I also want\nto find books that are not", | |
| "start": 1521.62, | |
| "duration": 2.55 | |
| }, | |
| { | |
| "text": "written in the hardcover\nformat, like they", | |
| "start": 1524.17, | |
| "duration": 2.64 | |
| }, | |
| { | |
| "text": "tend to be more expensive and so on.", | |
| "start": 1526.81, | |
| "duration": 1.63 | |
| }, | |
| { | |
| "text": "So I don't want hardcover books.", | |
| "start": 1528.44, | |
| "duration": 2.18 | |
| }, | |
| { | |
| "text": "Well, I could try a query like this.", | |
| "start": 1530.62, | |
| "duration": 1.93 | |
| }, | |
| { | |
| "text": "I could say SELECT \"title\" and \"format,\"\nwhere format is either hardcover", | |
| "start": 1532.55, | |
| "duration": 5.54 | |
| }, | |
| { | |
| "text": "or paperback, FROM my \"longlist\" table.", | |
| "start": 1538.09, | |
| "duration": 3.96 | |
| }, | |
| { | |
| "text": "And now I'll say, WHERE the \"format\"\nis not equal to hardcover Semicolon.", | |
| "start": 1542.05, | |
| "duration": 7.32 | |
| }, | |
| { | |
| "text": "So notice here I'm using\nsingle quotes for hardcover.", | |
| "start": 1549.37, | |
| "duration": 4.29 | |
| }, | |
| { | |
| "text": "This is a string.", | |
| "start": 1553.66, | |
| "duration": 1.3 | |
| }, | |
| { | |
| "text": "It's not a table name or a column name.", | |
| "start": 1554.96, | |
| "duration": 2.57 | |
| }, | |
| { | |
| "text": "It is just a string.", | |
| "start": 1557.53, | |
| "duration": 1.05 | |
| }, | |
| { | |
| "text": "So I'm using single quotes here.", | |
| "start": 1558.58, | |
| "duration": 2.19 | |
| }, | |
| { | |
| "text": "Everything else, though, like\nformat, longlist, title, et cetera,", | |
| "start": 1560.77, | |
| "duration": 4.23 | |
| }, | |
| { | |
| "text": "those are all table\nnames or column names.", | |
| "start": 1565.0, | |
| "duration": 3.4 | |
| }, | |
| { | |
| "text": "So again, I'll hit Enter.", | |
| "start": 1568.4, | |
| "duration": 1.46 | |
| }, | |
| { | |
| "text": "And now I'll see that these are all\nin paperback according to my table.", | |
| "start": 1569.86, | |
| "duration": 5.23 | |
| }, | |
| { | |
| "text": "I've omitted those that are hardcover.", | |
| "start": 1575.09, | |
| "duration": 2.9 | |
| }, | |
| { | |
| "text": "Well, I could also use in this\ncase, the greater than or less", | |
| "start": 1577.99, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "than sign put together to\nsay not equals as well.", | |
| "start": 1581.98, | |
| "duration": 3.25 | |
| }, | |
| { | |
| "text": "Let me just hit the Up\nArrow on my computer", | |
| "start": 1585.23, | |
| "duration": 1.97 | |
| }, | |
| { | |
| "text": "to reveal what I just previously typed.", | |
| "start": 1587.2, | |
| "duration": 2.34 | |
| }, | |
| { | |
| "text": "I'll then tab back over and say not\nexclamation point equals, but less than", | |
| "start": 1589.54, | |
| "duration": 6.87 | |
| }, | |
| { | |
| "text": "and then greater than.", | |
| "start": 1596.41, | |
| "duration": 1.26 | |
| }, | |
| { | |
| "text": "Hit Enter now.", | |
| "start": 1597.67, | |
| "duration": 1.17 | |
| }, | |
| { | |
| "text": "And I should see the very same results.", | |
| "start": 1598.84, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "But all I did was change this\noperator from exclamation point", | |
| "start": 1601.15, | |
| "duration": 3.12 | |
| }, | |
| { | |
| "text": "equals to less than and greater than.", | |
| "start": 1604.27, | |
| "duration": 2.76 | |
| }, | |
| { | |
| "text": "It tends to be that the\nexclamation point equals", | |
| "start": 1607.03, | |
| "duration": 2.22 | |
| }, | |
| { | |
| "text": "is the more common operator in this\ncase, but they do the very same thing.", | |
| "start": 1609.25, | |
| "duration": 6.18 | |
| }, | |
| { | |
| "text": "Now, one more keyword I could\nuse here that's worth mentioning", | |
| "start": 1615.43, | |
| "duration": 3.83 | |
| }, | |
| { | |
| "text": "is this keyword called NOT.", | |
| "start": 1619.26, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "So here, I was able to use\nexclamation point equals or the less", | |
| "start": 1621.57, | |
| "duration": 4.38 | |
| }, | |
| { | |
| "text": "than or greater than\nsign to say not equals.", | |
| "start": 1625.95, | |
| "duration": 2.34 | |
| }, | |
| { | |
| "text": "But I could also negate\na condition using NOT.", | |
| "start": 1628.29, | |
| "duration": 3.78 | |
| }, | |
| { | |
| "text": "So let's try using this one\nin our SQLite terminal too.", | |
| "start": 1632.07, | |
| "duration": 4.08 | |
| }, | |
| { | |
| "text": "I'll go back over here.", | |
| "start": 1636.15, | |
| "duration": 1.35 | |
| }, | |
| { | |
| "text": "And I'll bring back my SQLite terminal.", | |
| "start": 1637.5, | |
| "duration": 3.69 | |
| }, | |
| { | |
| "text": "I'll say let's do not this\noperator here, but instead use NOT.", | |
| "start": 1641.19, | |
| "duration": 6.33 | |
| }, | |
| { | |
| "text": "So I might, in front of WHERE, say\nWHERE NOT \"format\" equals \"hardcover.\"", | |
| "start": 1647.52, | |
| "duration": 8.22 | |
| }, | |
| { | |
| "text": "So I have a condition,\n\"format\" equals \"hardcover,\"", | |
| "start": 1655.74, | |
| "duration": 2.76 | |
| }, | |
| { | |
| "text": "but now I'm going to negate\nit, take the opposite of it", | |
| "start": 1658.5, | |
| "duration": 3.18 | |
| }, | |
| { | |
| "text": "and get back the very\nsame results here too.", | |
| "start": 1661.68, | |
| "duration": 4.92 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 1666.6, | |
| "duration": 1.46 | |
| }, | |
| { | |
| "text": "So to the question earlier, how\nwe can combine these conditionals.", | |
| "start": 1668.06, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "So let's try that here in just a minute.", | |
| "start": 1672.05, | |
| "duration": 2.95 | |
| }, | |
| { | |
| "text": "So let's say I wanted\nto find the books that", | |
| "start": 1675.0, | |
| "duration": 3.77 | |
| }, | |
| { | |
| "text": "were not just written in 2022 or 2023\nalone, but all the books together.", | |
| "start": 1678.77, | |
| "duration": 6.6 | |
| }, | |
| { | |
| "text": "Well for this, I could use a\nfew other SQL keywords that", | |
| "start": 1685.37, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "might be a little familiar to you too.", | |
| "start": 1688.04, | |
| "duration": 3.49 | |
| }, | |
| { | |
| "text": "Let's try looking at\nsome of these over here.", | |
| "start": 1691.53, | |
| "duration": 3.03 | |
| }, | |
| { | |
| "text": "So here, we have these called AND,\nOR, and these parentheses here too.", | |
| "start": 1694.56, | |
| "duration": 6.02 | |
| }, | |
| { | |
| "text": "So using AND and OR, I\ncan change conditionals.", | |
| "start": 1700.58, | |
| "duration": 4.65 | |
| }, | |
| { | |
| "text": "I can put them together to make a\nmore complex conditional, a compound", | |
| "start": 1705.23, | |
| "duration": 3.6 | |
| }, | |
| { | |
| "text": "condition.", | |
| "start": 1708.83, | |
| "duration": 1.05 | |
| }, | |
| { | |
| "text": "And I could also use these\nparentheses to symbolize", | |
| "start": 1709.88, | |
| "duration": 2.88 | |
| }, | |
| { | |
| "text": "that this condition\nshould come first and then", | |
| "start": 1712.76, | |
| "duration": 2.43 | |
| }, | |
| { | |
| "text": "some condition should\ncome afterwards as well.", | |
| "start": 1715.19, | |
| "duration": 2.5 | |
| }, | |
| { | |
| "text": "So let's try these in SQLite as well.", | |
| "start": 1717.69, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "I'll go back to my computer.", | |
| "start": 1720.78, | |
| "duration": 1.53 | |
| }, | |
| { | |
| "text": "And again, our goal is to find\nnot just books in 2022 or 2023,", | |
| "start": 1722.31, | |
| "duration": 4.91 | |
| }, | |
| { | |
| "text": "but books that work across\nthose years as well.", | |
| "start": 1727.22, | |
| "duration": 3.88 | |
| }, | |
| { | |
| "text": "So I'll, in this case say, SELECT--", | |
| "start": 1731.1, | |
| "duration": 2.12 | |
| }, | |
| { | |
| "text": "let's go for a \"title\" and\n\"author\" from my \"longlist\" table.", | |
| "start": 1733.22, | |
| "duration": 6.37 | |
| }, | |
| { | |
| "text": "Now, I'll say WHERE the\n\"year\" is 2022, as we did", | |
| "start": 1739.59, | |
| "duration": 5.52 | |
| }, | |
| { | |
| "text": "before, OR perhaps the \"year\" is 2023.", | |
| "start": 1745.11, | |
| "duration": 5.25 | |
| }, | |
| { | |
| "text": "And notice how my query is kind\nof wrapping around my terminal.", | |
| "start": 1750.36, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "I could leave it like this, or\nif I backspace just a little bit,", | |
| "start": 1754.23, | |
| "duration": 4.96 | |
| }, | |
| { | |
| "text": "I could hit Enter.", | |
| "start": 1759.19, | |
| "duration": 2.13 | |
| }, | |
| { | |
| "text": "And now I'm on a new line\nto continue my query.", | |
| "start": 1761.32, | |
| "duration": 3.85 | |
| }, | |
| { | |
| "text": "So here, I'll say OR \"year\" is 2023.", | |
| "start": 1765.17, | |
| "duration": 5.21 | |
| }, | |
| { | |
| "text": "And now my query is done.", | |
| "start": 1770.38, | |
| "duration": 1.96 | |
| }, | |
| { | |
| "text": "So I'll hit Semicolon.", | |
| "start": 1772.34, | |
| "duration": 1.34 | |
| }, | |
| { | |
| "text": "And I should see those books published\nin or nominated in 2022 or 2023.", | |
| "start": 1773.68, | |
| "duration": 8.88 | |
| }, | |
| { | |
| "text": "Let's try a few more here.", | |
| "start": 1782.56, | |
| "duration": 2.02 | |
| }, | |
| { | |
| "text": "Let's try using our parentheses as well.", | |
| "start": 1784.58, | |
| "duration": 2.21 | |
| }, | |
| { | |
| "text": "Maybe I want not just\nthese books but also", | |
| "start": 1786.79, | |
| "duration": 2.79 | |
| }, | |
| { | |
| "text": "those that are formatted\nin a hardcover format.", | |
| "start": 1789.58, | |
| "duration": 2.71 | |
| }, | |
| { | |
| "text": "So I'll say--", | |
| "start": 1792.29, | |
| "duration": 1.31 | |
| }, | |
| { | |
| "text": "I'll clear my terminal, Control-L\nagain, and SELECT \"title\" as well as,", | |
| "start": 1793.6, | |
| "duration": 6.59 | |
| }, | |
| { | |
| "text": "let's say, \"format\" from\nmy \"longlist\" table.", | |
| "start": 1800.19, | |
| "duration": 5.52 | |
| }, | |
| { | |
| "text": "And now, I'll hit my new\nline to extend my query", | |
| "start": 1805.71, | |
| "duration": 3.33 | |
| }, | |
| { | |
| "text": "without wrapping it on my terminal.", | |
| "start": 1809.04, | |
| "duration": 1.95 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 1810.99, | |
| "duration": 0.99 | |
| }, | |
| { | |
| "text": "And I'll say WHERE the \"year\"\nis 2022 OR the \"year\" is 2023.", | |
| "start": 1811.98, | |
| "duration": 8.46 | |
| }, | |
| { | |
| "text": "That's one condition.", | |
| "start": 1820.44, | |
| "duration": 1.77 | |
| }, | |
| { | |
| "text": "And I can denote that with a\nsingle set of parentheses here.", | |
| "start": 1822.21, | |
| "duration": 3.96 | |
| }, | |
| { | |
| "text": "I also want it to be true that\nthe \"format\" is not \"hardcover.\"", | |
| "start": 1826.17, | |
| "duration": 7.48 | |
| }, | |
| { | |
| "text": "So now, I'm adding\nanother condition in here.", | |
| "start": 1833.65, | |
| "duration": 3.0 | |
| }, | |
| { | |
| "text": "Now, I'll say Semicolon, hit Enter.", | |
| "start": 1836.65, | |
| "duration": 2.4 | |
| }, | |
| { | |
| "text": "And I'll get back only those books\nthat are published in the paperback", | |
| "start": 1839.05, | |
| "duration": 4.05 | |
| }, | |
| { | |
| "text": "format in 2022 and 2023.", | |
| "start": 1843.1, | |
| "duration": 6.09 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 1849.19, | |
| "duration": 1.23 | |
| }, | |
| { | |
| "text": "So let me pause again and ask if\nthere are any questions so far", | |
| "start": 1850.42, | |
| "duration": 3.42 | |
| }, | |
| { | |
| "text": "in how we've been using WHERE and\nSELECT and other conditions as well.", | |
| "start": 1853.84, | |
| "duration": 7.12 | |
| }, | |
| { | |
| "text": "SPEAKER: I would like\nto know about the--", | |
| "start": 1860.96, | |
| "duration": 4.16 | |
| }, | |
| { | |
| "text": "we can have a list of the top\ntitles available in the database.", | |
| "start": 1865.12, | |
| "duration": 4.92 | |
| }, | |
| { | |
| "text": "Like you have mentioned, the title,\nauthor, where we can know about that.", | |
| "start": 1870.04, | |
| "duration": 5.34 | |
| }, | |
| { | |
| "text": "What are the titles available in\nthe database using command below?", | |
| "start": 1875.38, | |
| "duration": 4.038 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah.", | |
| "start": 1879.418, | |
| "duration": 0.792 | |
| }, | |
| { | |
| "text": "So here I've been using these column\nnames called \"title\" and \"author.\"", | |
| "start": 1880.21, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "And I think your question is, how\nwould I know that I have these columns?", | |
| "start": 1883.42, | |
| "duration": 3.25 | |
| }, | |
| { | |
| "text": "Well, as we'll see in\nfuture times together,", | |
| "start": 1886.67, | |
| "duration": 2.85 | |
| }, | |
| { | |
| "text": "I'll be able to actually look at\nthe schema of my database, what", | |
| "start": 1889.52, | |
| "duration": 3.08 | |
| }, | |
| { | |
| "text": "columns are inside of it.", | |
| "start": 1892.6, | |
| "duration": 1.29 | |
| }, | |
| { | |
| "text": "For now, just take it\non my own word that I", | |
| "start": 1893.89, | |
| "duration": 3.39 | |
| }, | |
| { | |
| "text": "knew what was inside the database\nbefore I actually started querying it.", | |
| "start": 1897.28, | |
| "duration": 3.15 | |
| }, | |
| { | |
| "text": "We'll see later on how\nyou can take a database", | |
| "start": 1900.43, | |
| "duration": 1.95 | |
| }, | |
| { | |
| "text": "and understand the columns\nyou have there too.", | |
| "start": 1902.38, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "A good question.", | |
| "start": 1904.63, | |
| "duration": 1.21 | |
| }, | |
| { | |
| "text": "Let's jump into some more queries then.", | |
| "start": 1905.84, | |
| "duration": 2.24 | |
| }, | |
| { | |
| "text": "I'll go back to my computer.", | |
| "start": 1908.08, | |
| "duration": 1.53 | |
| }, | |
| { | |
| "text": "And let's see what else we\ncould do with these conditions.", | |
| "start": 1909.61, | |
| "duration": 3.97 | |
| }, | |
| { | |
| "text": "Well, not only could I try\nto make compound conditions,", | |
| "start": 1913.58, | |
| "duration": 3.8 | |
| }, | |
| { | |
| "text": "I could also try to find, let's\nsay, which data is missing.", | |
| "start": 1917.38, | |
| "duration": 5.1 | |
| }, | |
| { | |
| "text": "So I know in this table, I\nhave not just authors of books,", | |
| "start": 1922.48, | |
| "duration": 4.38 | |
| }, | |
| { | |
| "text": "but translators of those books.", | |
| "start": 1926.86, | |
| "duration": 2.76 | |
| }, | |
| { | |
| "text": "Often, books for the\nInternational Booker Prize", | |
| "start": 1929.62, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "were translated from some\nother language into English--", | |
| "start": 1931.66, | |
| "duration": 3.93 | |
| }, | |
| { | |
| "text": "but some weren't or at least\nthey didn't have a translator", | |
| "start": 1935.59, | |
| "duration": 3.0 | |
| }, | |
| { | |
| "text": "that was separate from the author.", | |
| "start": 1938.59, | |
| "duration": 1.89 | |
| }, | |
| { | |
| "text": "So to think about what data\nis missing from our table,", | |
| "start": 1940.48, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "we should introduce this new idea--", | |
| "start": 1943.57, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "this one called NULL.", | |
| "start": 1945.88, | |
| "duration": 2.56 | |
| }, | |
| { | |
| "text": "So I'll walk over here.", | |
| "start": 1948.44, | |
| "duration": 1.29 | |
| }, | |
| { | |
| "text": "And we'll see that we have this\ntype called NULL, where this", | |
| "start": 1949.73, | |
| "duration": 3.92 | |
| }, | |
| { | |
| "text": "means that this value doesn't exist.", | |
| "start": 1953.65, | |
| "duration": 1.83 | |
| }, | |
| { | |
| "text": "It's not in our database.", | |
| "start": 1955.48, | |
| "duration": 2.29 | |
| }, | |
| { | |
| "text": "We can actually put together a condition\naround this idea of null, something", | |
| "start": 1957.77, | |
| "duration": 4.52 | |
| }, | |
| { | |
| "text": "not being there.", | |
| "start": 1962.29, | |
| "duration": 1.71 | |
| }, | |
| { | |
| "text": "We could use IS NULL to\nfigure out if a value is null.", | |
| "start": 1964.0, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "It's not there.", | |
| "start": 1967.57, | |
| "duration": 0.658 | |
| }, | |
| { | |
| "text": "It's missing from our database.", | |
| "start": 1968.228, | |
| "duration": 1.292 | |
| }, | |
| { | |
| "text": "Or IS IT NULL, meaning\nthat it actually is there.", | |
| "start": 1969.52, | |
| "duration": 4.763 | |
| }, | |
| { | |
| "text": "So I'll go back to SQLite\nand show you what we could", | |
| "start": 1974.283, | |
| "duration": 2.167 | |
| }, | |
| { | |
| "text": "do with some of these concepts here.", | |
| "start": 1976.45, | |
| "duration": 3.52 | |
| }, | |
| { | |
| "text": "Let me go back to my terminal.", | |
| "start": 1979.97, | |
| "duration": 1.43 | |
| }, | |
| { | |
| "text": "And let's say I do want to\nfind those translators that", | |
| "start": 1981.4, | |
| "duration": 3.12 | |
| }, | |
| { | |
| "text": "don't exist in my database.", | |
| "start": 1984.52, | |
| "duration": 2.08 | |
| }, | |
| { | |
| "text": "Well, I could use SELECT, let's say,\n\"title\" and \"translator\" from my", | |
| "start": 1986.6, | |
| "duration": 6.8 | |
| }, | |
| { | |
| "text": "\"longlist.\"", | |
| "start": 1993.4, | |
| "duration": 1.05 | |
| }, | |
| { | |
| "text": "And I want to make sure that\nthese translators are null--", | |
| "start": 1994.45, | |
| "duration": 4.11 | |
| }, | |
| { | |
| "text": "they don't exist.", | |
| "start": 1998.56, | |
| "duration": 1.36 | |
| }, | |
| { | |
| "text": "So I'll say WHERE \"translator\"\nIS NULL Semicolon.", | |
| "start": 1999.92, | |
| "duration": 5.33 | |
| }, | |
| { | |
| "text": "Now, I'll hit Enter.", | |
| "start": 2005.25, | |
| "duration": 1.53 | |
| }, | |
| { | |
| "text": "And I should see two books.", | |
| "start": 2006.78, | |
| "duration": 1.438 | |
| }, | |
| { | |
| "text": "Titles are The Perfect Nine and\nthe indictment of The Enlightenment", | |
| "start": 2008.218, | |
| "duration": 2.792 | |
| }, | |
| { | |
| "text": "of The Greengate Tree.", | |
| "start": 2011.01, | |
| "duration": 0.917 | |
| }, | |
| { | |
| "text": "But notice how over here,\nthis value is null--", | |
| "start": 2011.927, | |
| "duration": 3.403 | |
| }, | |
| { | |
| "text": "it doesn't exist in my table.", | |
| "start": 2015.33, | |
| "duration": 2.74 | |
| }, | |
| { | |
| "text": "I could conversely find those books that\ndo have translators using IS NOT NULL.", | |
| "start": 2018.07, | |
| "duration": 5.27 | |
| }, | |
| { | |
| "text": "And I will try this one again.", | |
| "start": 2023.34, | |
| "duration": 2.71 | |
| }, | |
| { | |
| "text": "But in this case, I'll say, WHERE\n\"translator\" IS NOT NULL Semicolon.", | |
| "start": 2026.05, | |
| "duration": 7.85 | |
| }, | |
| { | |
| "text": "And I'll hit Enter.", | |
| "start": 2033.9, | |
| "duration": 1.77 | |
| }, | |
| { | |
| "text": "And now, let me just\nzoom out a little bit.", | |
| "start": 2035.67, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "I can see that I have both\ntitles on the left-hand side", | |
| "start": 2038.34, | |
| "duration": 5.13 | |
| }, | |
| { | |
| "text": "and translators on the right-hand side.", | |
| "start": 2043.47, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "All of these actually exists.", | |
| "start": 2045.78, | |
| "duration": 2.26 | |
| }, | |
| { | |
| "text": "These are books that did have\ntranslators in this case.", | |
| "start": 2048.04, | |
| "duration": 3.679 | |
| }, | |
| { | |
| "text": "So a good way to find data that's\nmissing in your table using", | |
| "start": 2051.719, | |
| "duration": 3.091 | |
| }, | |
| { | |
| "text": "NULL or IS NOT NULL.", | |
| "start": 2054.81, | |
| "duration": 2.822 | |
| }, | |
| { | |
| "text": "So let's come back over here\nand figure out what more", | |
| "start": 2057.632, | |
| "duration": 2.208 | |
| }, | |
| { | |
| "text": "we can do with some of these queries.", | |
| "start": 2059.84, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "We've kind of exhausted our work\nwith some of our conditions,", | |
| "start": 2062.51, | |
| "duration": 4.95 | |
| }, | |
| { | |
| "text": "like chaining them together\nand using NULL and so on.", | |
| "start": 2067.46, | |
| "duration": 2.35 | |
| }, | |
| { | |
| "text": "But one more thing we could do is\ntrying to use this idea of matching", | |
| "start": 2069.81, | |
| "duration": 4.73 | |
| }, | |
| { | |
| "text": "some kind of pattern in my database.", | |
| "start": 2074.54, | |
| "duration": 2.349 | |
| }, | |
| { | |
| "text": "So maybe I'm a book reader.", | |
| "start": 2076.889, | |
| "duration": 3.591 | |
| }, | |
| { | |
| "text": "And I want to find a book with the\nword \"love\" somewhere in the title.", | |
| "start": 2080.48, | |
| "duration": 3.989 | |
| }, | |
| { | |
| "text": "Well, for this, I could\nuse another keyword--", | |
| "start": 2084.469, | |
| "duration": 2.551 | |
| }, | |
| { | |
| "text": "this one called LIKE.", | |
| "start": 2087.02, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "So LIKE is a good keyword to\nuse when I want to roughly match", | |
| "start": 2089.27, | |
| "duration": 5.159 | |
| }, | |
| { | |
| "text": "some string in my database.", | |
| "start": 2094.429, | |
| "duration": 2.281 | |
| }, | |
| { | |
| "text": "Let's say I want to look\nat book titles and find", | |
| "start": 2096.71, | |
| "duration": 2.43 | |
| }, | |
| { | |
| "text": "if some word exists in that title.", | |
| "start": 2099.14, | |
| "duration": 2.52 | |
| }, | |
| { | |
| "text": "I could use LIKE for that.", | |
| "start": 2101.66, | |
| "duration": 2.41 | |
| }, | |
| { | |
| "text": "And LIKE becomes powerful\nwhen you combine it", | |
| "start": 2104.07, | |
| "duration": 2.36 | |
| }, | |
| { | |
| "text": "with these other operators, namely\nthis percent sign and this underscore.", | |
| "start": 2106.43, | |
| "duration": 4.4 | |
| }, | |
| { | |
| "text": "The percent sign can match any\ncharacter around a string I give it.", | |
| "start": 2110.83, | |
| "duration": 4.78 | |
| }, | |
| { | |
| "text": "And the underscore can\nmatch any single character", | |
| "start": 2115.61, | |
| "duration": 3.0 | |
| }, | |
| { | |
| "text": "that I pass in with my string.", | |
| "start": 2118.61, | |
| "duration": 2.37 | |
| }, | |
| { | |
| "text": "It's probably best\nshown with an example.", | |
| "start": 2120.98, | |
| "duration": 2.47 | |
| }, | |
| { | |
| "text": "So let me show you some\nin my terminal here.", | |
| "start": 2123.45, | |
| "duration": 2.81 | |
| }, | |
| { | |
| "text": "I'll walk back.", | |
| "start": 2126.26, | |
| "duration": 1.05 | |
| }, | |
| { | |
| "text": "And, again, we'll try\nto find these books that", | |
| "start": 2127.31, | |
| "duration": 2.07 | |
| }, | |
| { | |
| "text": "have \"love\" somewhere in the title.", | |
| "start": 2129.38, | |
| "duration": 2.85 | |
| }, | |
| { | |
| "text": "So I'll say in this case, SELECT,\nlet's say, \"title\" from \"longlist.\"", | |
| "start": 2132.23, | |
| "duration": 5.97 | |
| }, | |
| { | |
| "text": "But I don't want all titles.", | |
| "start": 2138.2, | |
| "duration": 1.68 | |
| }, | |
| { | |
| "text": "I only want those that have\n\"love\" somewhere in this title.", | |
| "start": 2139.88, | |
| "duration": 4.06 | |
| }, | |
| { | |
| "text": "So I'll say WHERE \"title\" LIKE, let's\nsay, percent love percent Semicolon.", | |
| "start": 2143.94, | |
| "duration": 9.71 | |
| }, | |
| { | |
| "text": "Now before I run this, let me\nexplain what this is doing.", | |
| "start": 2153.65, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "I have here a SELECT query\nasking for the \"title\"", | |
| "start": 2157.64, | |
| "duration": 3.96 | |
| }, | |
| { | |
| "text": "column from my \"longlist\" table.", | |
| "start": 2161.6, | |
| "duration": 3.0 | |
| }, | |
| { | |
| "text": "But I'll only get back those rows where\n\"title\" is LIKE percent love percent.", | |
| "start": 2164.6, | |
| "duration": 6.51 | |
| }, | |
| { | |
| "text": "But what does that mean?", | |
| "start": 2171.11, | |
| "duration": 1.42 | |
| }, | |
| { | |
| "text": "Well, the percent, remember,\nmatches any string of characters.", | |
| "start": 2172.53, | |
| "duration": 3.8 | |
| }, | |
| { | |
| "text": "It could match a, b, c, 1, 2, 3.", | |
| "start": 2176.33, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "As long as any string of characters\ncomes after and has \"love,\"", | |
| "start": 2178.58, | |
| "duration": 3.69 | |
| }, | |
| { | |
| "text": "I could match that value here.", | |
| "start": 2182.27, | |
| "duration": 3.19 | |
| }, | |
| { | |
| "text": "Similarly, the percent\nsign after says anything", | |
| "start": 2185.46, | |
| "duration": 2.585 | |
| }, | |
| { | |
| "text": "that comes after \"love,\" as long as\n\"love\" is somewhere in the middle.", | |
| "start": 2188.045, | |
| "duration": 4.585 | |
| }, | |
| { | |
| "text": "So anything before, anything\nafter, but so long as \"love\"", | |
| "start": 2192.63, | |
| "duration": 3.59 | |
| }, | |
| { | |
| "text": "is just somewhere in\nthere, I'll get it back.", | |
| "start": 2196.22, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "So let me try that running this\nquery then and come back over here.", | |
| "start": 2198.53, | |
| "duration": 3.75 | |
| }, | |
| { | |
| "text": "I will hit Enter on my query.", | |
| "start": 2202.28, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "And I'll see I get back four books--", | |
| "start": 2204.53, | |
| "duration": 2.52 | |
| }, | |
| { | |
| "text": "Love in the Big City, More\nThan I Love My Life and so on.", | |
| "start": 2207.05, | |
| "duration": 4.06 | |
| }, | |
| { | |
| "text": "So notice how if I come back over\nhere that each of these titles", | |
| "start": 2211.11, | |
| "duration": 3.77 | |
| }, | |
| { | |
| "text": "has \"love\" somewhere in it.", | |
| "start": 2214.88, | |
| "duration": 1.83 | |
| }, | |
| { | |
| "text": "For this one, I match\nlove up front and then", | |
| "start": 2216.71, | |
| "duration": 3.42 | |
| }, | |
| { | |
| "text": "had any string of characters\ncoming after it like this.", | |
| "start": 2220.13, | |
| "duration": 2.8 | |
| }, | |
| { | |
| "text": "For this one, I had More\nThan I Love My Life.", | |
| "start": 2222.93, | |
| "duration": 2.75 | |
| }, | |
| { | |
| "text": "I got some string before it.", | |
| "start": 2225.68, | |
| "duration": 1.71 | |
| }, | |
| { | |
| "text": "And then afterwards, any string after\nit, \"love\" is somewhere in the middle.", | |
| "start": 2227.39, | |
| "duration": 5.19 | |
| }, | |
| { | |
| "text": "Let me show you another\nexample too, where", | |
| "start": 2232.58, | |
| "duration": 2.07 | |
| }, | |
| { | |
| "text": "we use percent in a different way.", | |
| "start": 2234.65, | |
| "duration": 2.71 | |
| }, | |
| { | |
| "text": "Let's say I want to find\nonly those books that", | |
| "start": 2237.36, | |
| "duration": 2.51 | |
| }, | |
| { | |
| "text": "have \"The\" at the very\nbeginning of the title.", | |
| "start": 2239.87, | |
| "duration": 3.45 | |
| }, | |
| { | |
| "text": "Let me try this.", | |
| "start": 2243.32, | |
| "duration": 1.09 | |
| }, | |
| { | |
| "text": "I'll say a SELECT \"title\"\nfrom \"longlist\" then WHERE,", | |
| "start": 2244.41, | |
| "duration": 6.47 | |
| }, | |
| { | |
| "text": "let's say, the \"title\" is\nLIKE the percent Semicolon.", | |
| "start": 2250.88, | |
| "duration": 9.08 | |
| }, | |
| { | |
| "text": "Now, I've changed something up.", | |
| "start": 2259.96, | |
| "duration": 1.9 | |
| }, | |
| { | |
| "text": "I have not percent in front and\nbehind, but only after the \"The.\"", | |
| "start": 2261.86, | |
| "duration": 5.9 | |
| }, | |
| { | |
| "text": "So in this case, I'll\nget back not anything", | |
| "start": 2267.76, | |
| "duration": 2.91 | |
| }, | |
| { | |
| "text": "that has \"The\" the\ntitle wherever, but now", | |
| "start": 2270.67, | |
| "duration": 3.0 | |
| }, | |
| { | |
| "text": "at the very beginning of this string.", | |
| "start": 2273.67, | |
| "duration": 2.94 | |
| }, | |
| { | |
| "text": "And I see perhaps a style mistake.", | |
| "start": 2276.61, | |
| "duration": 3.03 | |
| }, | |
| { | |
| "text": "Let me ask the audience,\nwhat style mistake did", | |
| "start": 2279.64, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "I just make when I typed in this query?", | |
| "start": 2281.95, | |
| "duration": 3.73 | |
| }, | |
| { | |
| "text": "So I'm seeing maybe I used double quotes\nwhen I should have used single quotes.", | |
| "start": 2285.68, | |
| "duration": 3.915 | |
| }, | |
| { | |
| "text": "So let me come back and fix that first.", | |
| "start": 2289.595, | |
| "duration": 1.625 | |
| }, | |
| { | |
| "text": "I'll come back over here.", | |
| "start": 2291.22, | |
| "duration": 1.5 | |
| }, | |
| { | |
| "text": "And, again, by convention, we tend\nto use single quotes for our strings.", | |
| "start": 2292.72, | |
| "duration": 5.04 | |
| }, | |
| { | |
| "text": "So let me fix that right here.", | |
| "start": 2297.76, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "And now let me run this query\nto see what we get back.", | |
| "start": 2299.8, | |
| "duration": 2.43 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 2302.23, | |
| "duration": 1.05 | |
| }, | |
| { | |
| "text": "And I'll see only those\nbooks that begin with \"The.\"", | |
| "start": 2303.28, | |
| "duration": 4.97 | |
| }, | |
| { | |
| "text": "Now, let me show this\nquery again, though.", | |
| "start": 2308.25, | |
| "duration": 4.55 | |
| }, | |
| { | |
| "text": "This was our query here.", | |
| "start": 2312.8, | |
| "duration": 2.1 | |
| }, | |
| { | |
| "text": "Knowing what we know\nabout the percent sign,", | |
| "start": 2314.9, | |
| "duration": 4.17 | |
| }, | |
| { | |
| "text": "what other titles might I accidentally\nget back by running this query?", | |
| "start": 2319.07, | |
| "duration": 5.94 | |
| }, | |
| { | |
| "text": "I have \"The\" percent.", | |
| "start": 2325.01, | |
| "duration": 2.295 | |
| }, | |
| { | |
| "text": "But what other words actually\nbegin these book titles", | |
| "start": 2327.305, | |
| "duration": 3.945 | |
| }, | |
| { | |
| "text": "if I were to run this query here?", | |
| "start": 2331.25, | |
| "duration": 2.52 | |
| }, | |
| { | |
| "text": "We saw only those with \"The,\" but if\nI had other book titles, what might", | |
| "start": 2333.77, | |
| "duration": 3.33 | |
| }, | |
| { | |
| "text": "I get back?", | |
| "start": 2337.1, | |
| "duration": 1.52 | |
| }, | |
| { | |
| "text": "So I might get back\nthose book titles that", | |
| "start": 2338.62, | |
| "duration": 1.95 | |
| }, | |
| { | |
| "text": "have not just \"The\" the\nbeginning but also, let's say,", | |
| "start": 2340.57, | |
| "duration": 3.45 | |
| }, | |
| { | |
| "text": "\"There\" or \"They\" or so on.", | |
| "start": 2344.02, | |
| "duration": 2.2 | |
| }, | |
| { | |
| "text": "There are many words\nbeginning with T-H-E.", | |
| "start": 2346.22, | |
| "duration": 2.585 | |
| }, | |
| { | |
| "text": "And if I had the percent\nsign right after it,", | |
| "start": 2348.805, | |
| "duration": 1.875 | |
| }, | |
| { | |
| "text": "I might match one of those\nwords like Y or R-E or so on.", | |
| "start": 2350.68, | |
| "duration": 4.72 | |
| }, | |
| { | |
| "text": "So I didn't have any of those\ntitles in this database.", | |
| "start": 2355.4, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "But you can imagine a different\ndatabase where I have that kind of data.", | |
| "start": 2357.65, | |
| "duration": 5.26 | |
| }, | |
| { | |
| "text": "Let's fix this then.", | |
| "start": 2362.91, | |
| "duration": 1.35 | |
| }, | |
| { | |
| "text": "I say, I want to match not just\n\"The\" but \"The\" and a space,", | |
| "start": 2364.26, | |
| "duration": 4.69 | |
| }, | |
| { | |
| "text": "and match any characters\nafter that to make this", | |
| "start": 2368.95, | |
| "duration": 2.15 | |
| }, | |
| { | |
| "text": "query better designed in this instance.", | |
| "start": 2371.1, | |
| "duration": 4.28 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 2375.38, | |
| "duration": 0.83 | |
| }, | |
| { | |
| "text": "So let me pause here then\nand ask what questions we", | |
| "start": 2376.21, | |
| "duration": 2.73 | |
| }, | |
| { | |
| "text": "have on using percent along with LIKE.", | |
| "start": 2378.94, | |
| "duration": 5.24 | |
| }, | |
| { | |
| "text": "SPEAKER: Can we use two percent\nsigns between two words?", | |
| "start": 2384.18, | |
| "duration": 3.958 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah, I think so.", | |
| "start": 2388.138, | |
| "duration": 1.292 | |
| }, | |
| { | |
| "text": "So let me go back to my terminal here\nand let me try to answer this question.", | |
| "start": 2389.43, | |
| "duration": 3.31 | |
| }, | |
| { | |
| "text": "So can we use two percent signs to\nsay something's between two words?", | |
| "start": 2392.74, | |
| "duration": 4.05 | |
| }, | |
| { | |
| "text": "So let me say this.", | |
| "start": 2396.79, | |
| "duration": 1.1 | |
| }, | |
| { | |
| "text": "I'll go with SELECT, let's say,\n\"title\" from \"longlist\" WHERE maybe", | |
| "start": 2397.89, | |
| "duration": 8.82 | |
| }, | |
| { | |
| "text": "the \"title\" has something like--", | |
| "start": 2406.71, | |
| "duration": 3.51 | |
| }, | |
| { | |
| "text": "maybe it begins with \"The.\"", | |
| "start": 2410.22, | |
| "duration": 1.41 | |
| }, | |
| { | |
| "text": "So I'll say WHERE \"title\" LIKE \"The.\"", | |
| "start": 2411.63, | |
| "duration": 5.58 | |
| }, | |
| { | |
| "text": "And then I'll take any set\nof characters afterwards.", | |
| "start": 2417.21, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "But I want to have\n\"love\" also in here too.", | |
| "start": 2420.78, | |
| "duration": 2.85 | |
| }, | |
| { | |
| "text": "So I'll say \"love.\"", | |
| "start": 2423.63, | |
| "duration": 1.44 | |
| }, | |
| { | |
| "text": "And then I'll take any other characters\nafter it, percent again, single quote,", | |
| "start": 2425.07, | |
| "duration": 6.43 | |
| }, | |
| { | |
| "text": "Semicolon.", | |
| "start": 2431.5, | |
| "duration": 1.38 | |
| }, | |
| { | |
| "text": "Now, I don't know if I have any\nbooks that actually fit this search.", | |
| "start": 2432.88, | |
| "duration": 4.53 | |
| }, | |
| { | |
| "text": "But I could say the percent\nlove percent to mean give me", | |
| "start": 2437.41, | |
| "duration": 4.35 | |
| }, | |
| { | |
| "text": "back any title that has\n\"The\" at the beginning", | |
| "start": 2441.76, | |
| "duration": 2.97 | |
| }, | |
| { | |
| "text": "then any words or characters then\n\"love\" then any words or characters", | |
| "start": 2444.73, | |
| "duration": 3.78 | |
| }, | |
| { | |
| "text": "after that.", | |
| "start": 2448.51, | |
| "duration": 1.17 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 2449.68, | |
| "duration": 0.81 | |
| }, | |
| { | |
| "text": "And I see I don't have any books\nthat fit that kind of description.", | |
| "start": 2450.49, | |
| "duration": 3.82 | |
| }, | |
| { | |
| "text": "But if I did, I would see them here\nwith \"The\" at the beginning and \"love\"", | |
| "start": 2454.31, | |
| "duration": 4.1 | |
| }, | |
| { | |
| "text": "somewhere in the title.", | |
| "start": 2458.41, | |
| "duration": 3.29 | |
| }, | |
| { | |
| "text": "All right.", | |
| "start": 2461.7, | |
| "duration": 0.5 | |
| }, | |
| { | |
| "text": "So let's keep going.", | |
| "start": 2462.2, | |
| "duration": 0.833 | |
| }, | |
| { | |
| "text": "Let's focus not just on this percent\nsign, but also on this underscore.", | |
| "start": 2463.033, | |
| "duration": 4.977 | |
| }, | |
| { | |
| "text": "So if I want to find--", | |
| "start": 2468.01, | |
| "duration": 1.32 | |
| }, | |
| { | |
| "text": "let's say, I don't know what a\nparticular character is in my title.", | |
| "start": 2469.33, | |
| "duration": 4.62 | |
| }, | |
| { | |
| "text": "I could use this underscore to\nmatch any particular character.", | |
| "start": 2473.95, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "Not any string of characters,\nbut any single character too.", | |
| "start": 2477.58, | |
| "duration": 3.24 | |
| }, | |
| { | |
| "text": "So let's try this in our terminal.", | |
| "start": 2480.82, | |
| "duration": 2.43 | |
| }, | |
| { | |
| "text": "And there is a book,\nthis one called a Pyre.", | |
| "start": 2483.25, | |
| "duration": 3.18 | |
| }, | |
| { | |
| "text": "And I actually keep\nforgetting how it's spelled.", | |
| "start": 2486.43, | |
| "duration": 2.73 | |
| }, | |
| { | |
| "text": "I don't know whether it's P-I-R-E\nor P-Y-R-E. It could be either one,", | |
| "start": 2489.16, | |
| "duration": 5.53 | |
| }, | |
| { | |
| "text": "but I want to find it in my database.", | |
| "start": 2494.69, | |
| "duration": 2.07 | |
| }, | |
| { | |
| "text": "So let me try this.", | |
| "start": 2496.76, | |
| "duration": 1.01 | |
| }, | |
| { | |
| "text": "I'll say SELECT, let's say, \"title\"\nFROM \"longlist,\" WHERE, in this case,", | |
| "start": 2497.77, | |
| "duration": 6.9 | |
| }, | |
| { | |
| "text": "\"title\" is LIKE--", | |
| "start": 2504.67, | |
| "duration": 2.13 | |
| }, | |
| { | |
| "text": "well, I know that it\nstarts with a P. And I", | |
| "start": 2506.8, | |
| "duration": 2.94 | |
| }, | |
| { | |
| "text": "don't know if this is an I or a Y. But\nI'll at least leave it as an underscore", | |
| "start": 2509.74, | |
| "duration": 4.26 | |
| }, | |
| { | |
| "text": "now to say it could\nbe any character here.", | |
| "start": 2514.0, | |
| "duration": 2.88 | |
| }, | |
| { | |
| "text": "Then I'll say R-E\nsingle quote, Semicolon.", | |
| "start": 2516.88, | |
| "duration": 5.92 | |
| }, | |
| { | |
| "text": "And now I could try hitting Enter.", | |
| "start": 2522.8, | |
| "duration": 2.06 | |
| }, | |
| { | |
| "text": "And I'll see I get back\nthis title called Pyre.", | |
| "start": 2524.86, | |
| "duration": 3.96 | |
| }, | |
| { | |
| "text": "So notice in this case that\nthe underscore is matching", | |
| "start": 2528.82, | |
| "duration": 3.24 | |
| }, | |
| { | |
| "text": "literally any single character.", | |
| "start": 2532.06, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "This could be a Y. It could be an I.\nBut in this case, I have this Y here.", | |
| "start": 2534.31, | |
| "duration": 5.92 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 2540.23, | |
| "duration": 0.605 | |
| }, | |
| { | |
| "text": "Let me go back.", | |
| "start": 2540.835, | |
| "duration": 0.625 | |
| }, | |
| { | |
| "text": "And let's actually ask in\nthis case what questions we", | |
| "start": 2541.46, | |
| "duration": 2.46 | |
| }, | |
| { | |
| "text": "have on using LIKE with these\nsingle underscores if any.", | |
| "start": 2543.92, | |
| "duration": 4.157 | |
| }, | |
| { | |
| "text": "SPEAKER: Yeah.", | |
| "start": 2548.077, | |
| "duration": 0.583 | |
| }, | |
| { | |
| "text": "So Carter, I wanted to ask you, that\nas you use the underscore sign here,", | |
| "start": 2548.66, | |
| "duration": 4.57 | |
| }, | |
| { | |
| "text": "so for multiple characters, can we\nuse multiple underscores in order", | |
| "start": 2553.23, | |
| "duration": 4.16 | |
| }, | |
| { | |
| "text": "to find something in the database?", | |
| "start": 2557.39, | |
| "duration": 2.308 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: A great question.", | |
| "start": 2559.698, | |
| "duration": 1.292 | |
| }, | |
| { | |
| "text": "Could we use more than one\nunderscore to try to find", | |
| "start": 2560.99, | |
| "duration": 2.777 | |
| }, | |
| { | |
| "text": "some characters in our database?", | |
| "start": 2563.767, | |
| "duration": 1.333 | |
| }, | |
| { | |
| "text": "You absolutely could.", | |
| "start": 2565.1, | |
| "duration": 0.875 | |
| }, | |
| { | |
| "text": "So let me try that myself.", | |
| "start": 2565.975, | |
| "duration": 1.525 | |
| }, | |
| { | |
| "text": "I'll go back to my terminal.", | |
| "start": 2567.5, | |
| "duration": 2.13 | |
| }, | |
| { | |
| "text": "And let me try to find a book\ntitle this could work with.", | |
| "start": 2569.63, | |
| "duration": 2.88 | |
| }, | |
| { | |
| "text": "I'll say maybe SELECT\n\"title\" from \"longlist\"", | |
| "start": 2572.51, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "to get back all the books in this table.", | |
| "start": 2576.38, | |
| "duration": 2.28 | |
| }, | |
| { | |
| "text": "I'll hit Semicolon.", | |
| "start": 2578.66, | |
| "duration": 1.32 | |
| }, | |
| { | |
| "text": "And maybe I will go with--", | |
| "start": 2579.98, | |
| "duration": 2.775 | |
| }, | |
| { | |
| "text": "let's try this one called Tyll.", | |
| "start": 2585.93, | |
| "duration": 2.79 | |
| }, | |
| { | |
| "text": "Well, maybe I want to just find the\ntitles that have a Y or an I in here,", | |
| "start": 2588.72, | |
| "duration": 5.04 | |
| }, | |
| { | |
| "text": "but I also don't know if it's one\nL or maybe two L's, for instance.", | |
| "start": 2593.76, | |
| "duration": 3.933 | |
| }, | |
| { | |
| "text": "Let me go back and try this.", | |
| "start": 2597.693, | |
| "duration": 1.167 | |
| }, | |
| { | |
| "text": "I'll say SELECT, let's say, \"title\" FROM\n\"longlist\" WHERE my \"title\" is LIKE--", | |
| "start": 2598.86, | |
| "duration": 8.07 | |
| }, | |
| { | |
| "text": "I know it begins with a T. I\ndon't know if this is a Y or an I.", | |
| "start": 2606.93, | |
| "duration": 4.56 | |
| }, | |
| { | |
| "text": "And maybe I know that it has maybe\none or two characters after it.", | |
| "start": 2611.49, | |
| "duration": 4.62 | |
| }, | |
| { | |
| "text": "So I'll try this one.", | |
| "start": 2616.11, | |
| "duration": 1.5 | |
| }, | |
| { | |
| "text": "Now I have three underscores,\nsingle underscore.", | |
| "start": 2617.61, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "So match any book title that\nhas T and then any three", | |
| "start": 2620.82, | |
| "duration": 4.38 | |
| }, | |
| { | |
| "text": "individual characters after it.", | |
| "start": 2625.2, | |
| "duration": 1.8 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 2627.0, | |
| "duration": 1.29 | |
| }, | |
| { | |
| "text": "And I'll see I get back Tyll.", | |
| "start": 2628.29, | |
| "duration": 2.01 | |
| }, | |
| { | |
| "text": "This is the only title that has T\nand then three characters after it.", | |
| "start": 2630.3, | |
| "duration": 5.7 | |
| }, | |
| { | |
| "text": "I could try to get better with this.", | |
| "start": 2636.0, | |
| "duration": 1.69 | |
| }, | |
| { | |
| "text": "I could say maybe I'll accept\nfive or six characters like that.", | |
| "start": 2637.69, | |
| "duration": 3.29 | |
| }, | |
| { | |
| "text": "Hit Enter.", | |
| "start": 2640.98, | |
| "duration": 1.05 | |
| }, | |
| { | |
| "text": "And I'll see-- whoops, I\ndidn't compute my query here.", | |
| "start": 2642.03, | |
| "duration": 2.467 | |
| }, | |
| { | |
| "text": "Let me just try it from the top again.", | |
| "start": 2644.497, | |
| "duration": 1.583 | |
| }, | |
| { | |
| "text": "I'll say SELECT \"title\"\nfrom \"longlist\" where", | |
| "start": 2646.08, | |
| "duration": 2.79 | |
| }, | |
| { | |
| "text": "title is like, let's say,\nT-Y underscore, underscore,", | |
| "start": 2648.87, | |
| "duration": 3.9 | |
| }, | |
| { | |
| "text": "underscore, underscore.", | |
| "start": 2652.77, | |
| "duration": 1.2 | |
| }, | |
| { | |
| "text": "Hit Semicolon.", | |
| "start": 2653.97, | |
| "duration": 2.82 | |
| }, | |
| { | |
| "text": "And now I get no matches.", | |
| "start": 2656.79, | |
| "duration": 1.46 | |
| }, | |
| { | |
| "text": "So there is no book in\nthe database that has T-Y", | |
| "start": 2658.25, | |
| "duration": 3.84 | |
| }, | |
| { | |
| "text": "and then, let's say, three or four\nunderscores for any character after it.", | |
| "start": 2662.09, | |
| "duration": 6.05 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 2668.14, | |
| "duration": 0.69 | |
| }, | |
| { | |
| "text": "So this covers our\nuse of LIKE, but let's", | |
| "start": 2668.83, | |
| "duration": 4.08 | |
| }, | |
| { | |
| "text": "keep going and building\nmore complex conditions", | |
| "start": 2672.91, | |
| "duration": 2.22 | |
| }, | |
| { | |
| "text": "to find even more answers to questions\nwe have about this data over here.", | |
| "start": 2675.13, | |
| "duration": 5.31 | |
| }, | |
| { | |
| "text": "Let me think what we should show next.", | |
| "start": 2680.44, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "We've seen LIKE.", | |
| "start": 2683.53, | |
| "duration": 1.26 | |
| }, | |
| { | |
| "text": "We've seen some compound conditionals.", | |
| "start": 2684.79, | |
| "duration": 2.07 | |
| }, | |
| { | |
| "text": "Well, let's go back to trying to find\nbooks that are in a certain year.", | |
| "start": 2686.86, | |
| "duration": 4.53 | |
| }, | |
| { | |
| "text": "So we saw earlier we\nhad this kind of query.", | |
| "start": 2691.39, | |
| "duration": 3.15 | |
| }, | |
| { | |
| "text": "We could say SELECT \"title\" and \"year\"\nFROM, let's say, our \"longlist.\"", | |
| "start": 2694.54, | |
| "duration": 6.27 | |
| }, | |
| { | |
| "text": "Now I can try to find those books\nthat are written or nominated", | |
| "start": 2700.81, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "in 2022 and 2023.", | |
| "start": 2704.38, | |
| "duration": 2.61 | |
| }, | |
| { | |
| "text": "But let's say I want to go further.", | |
| "start": 2706.99, | |
| "duration": 1.89 | |
| }, | |
| { | |
| "text": "I want those from 2019 to 2022,\na span of multiple years here.", | |
| "start": 2708.88, | |
| "duration": 6.25 | |
| }, | |
| { | |
| "text": "So I could try it like\nthis, WHERE \"year\" equals--", | |
| "start": 2715.13, | |
| "duration": 3.86 | |
| }, | |
| { | |
| "text": "let's go ahead and say 2019--", | |
| "start": 2718.99, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "OR \"year\" is 2020 OR \"year\" is 2021.", | |
| "start": 2721.3, | |
| "duration": 6.86 | |
| }, | |
| { | |
| "text": "And let me make a new line again.", | |
| "start": 2728.16, | |
| "duration": 2.22 | |
| }, | |
| { | |
| "text": "OR \"year\" is 2022 Semicolon.", | |
| "start": 2730.38, | |
| "duration": 5.81 | |
| }, | |
| { | |
| "text": "And before I run this query,\nlet me ask our audience,", | |
| "start": 2736.19, | |
| "duration": 3.75 | |
| }, | |
| { | |
| "text": "what strikes you as being not very\nwell designed about this query?", | |
| "start": 2739.94, | |
| "duration": 4.97 | |
| }, | |
| { | |
| "text": "What could I be doing better here?", | |
| "start": 2744.91, | |
| "duration": 2.65 | |
| }, | |
| { | |
| "text": "So I'm seeing maybe one improvement\nis that I don't need to write out", | |
| "start": 2747.56, | |
| "duration": 5.09 | |
| }, | |
| { | |
| "text": "OR \"year\" is this, OR \"year\" is that.", | |
| "start": 2752.65, | |
| "duration": 3.3 | |
| }, | |
| { | |
| "text": "I could probably do better with this.", | |
| "start": 2755.95, | |
| "duration": 1.95 | |
| }, | |
| { | |
| "text": "And let's introduce some\nnew keywords for working", | |
| "start": 2757.9, | |
| "duration": 2.73 | |
| }, | |
| { | |
| "text": "with ranges in terms of our conditions.", | |
| "start": 2760.63, | |
| "duration": 3.61 | |
| }, | |
| { | |
| "text": "So here, we can see some\nnew operators to use.", | |
| "start": 2764.24, | |
| "duration": 4.22 | |
| }, | |
| { | |
| "text": "We have this greater than\nsign, this less than sign,", | |
| "start": 2768.46, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "greater than or equal to,\nand less than or equal to.", | |
| "start": 2772.45, | |
| "duration": 2.91 | |
| }, | |
| { | |
| "text": "And we can use these to build\nranges inside of our queries to say,", | |
| "start": 2775.36, | |
| "duration": 4.44 | |
| }, | |
| { | |
| "text": "I want something to be greater than this\nnumber or less than this number too.", | |
| "start": 2779.8, | |
| "duration": 4.83 | |
| }, | |
| { | |
| "text": "And we can combine these\nwith AND and our OR", | |
| "start": 2784.63, | |
| "duration": 2.55 | |
| }, | |
| { | |
| "text": "we saw before to get back in\nthis case some set of rows", | |
| "start": 2787.18, | |
| "duration": 4.26 | |
| }, | |
| { | |
| "text": "that match what we intend to find.", | |
| "start": 2791.44, | |
| "duration": 2.79 | |
| }, | |
| { | |
| "text": "So let me go back and\ntry some of these out.", | |
| "start": 2794.23, | |
| "duration": 2.22 | |
| }, | |
| { | |
| "text": "I'll try to improve the\ndesign of this query.", | |
| "start": 2796.45, | |
| "duration": 3.39 | |
| }, | |
| { | |
| "text": "Let me first run it, and we'll\nsee we do get back 2019 to 2022.", | |
| "start": 2799.84, | |
| "duration": 6.51 | |
| }, | |
| { | |
| "text": "But I could probably do better.", | |
| "start": 2806.35, | |
| "duration": 1.63 | |
| }, | |
| { | |
| "text": "So let's try using\nour new operators here", | |
| "start": 2807.98, | |
| "duration": 2.78 | |
| }, | |
| { | |
| "text": "that can give us some\nrange capabilities.", | |
| "start": 2810.76, | |
| "duration": 2.61 | |
| }, | |
| { | |
| "text": "I'll say SELECT \"title\" and also\nSELECT \"year\" from \"longlist.\"", | |
| "start": 2813.37, | |
| "duration": 6.42 | |
| }, | |
| { | |
| "text": "But now I want those rows where the\nyear is greater than or equal to 2019,", | |
| "start": 2819.79, | |
| "duration": 7.29 | |
| }, | |
| { | |
| "text": "and the year is less than\nor equal to 2022 Semicolon.", | |
| "start": 2827.08, | |
| "duration": 6.3 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 2833.38, | |
| "duration": 1.57 | |
| }, | |
| { | |
| "text": "Notice I'll get the very same results.", | |
| "start": 2834.95, | |
| "duration": 2.16 | |
| }, | |
| { | |
| "text": "So I get all those same rows.", | |
| "start": 2837.11, | |
| "duration": 1.91 | |
| }, | |
| { | |
| "text": "But now my query is much smaller.", | |
| "start": 2839.02, | |
| "duration": 2.68 | |
| }, | |
| { | |
| "text": "It's making use of these range\noperators I've seen so far.", | |
| "start": 2841.7, | |
| "duration": 4.64 | |
| }, | |
| { | |
| "text": "I could even further improve this.", | |
| "start": 2846.34, | |
| "duration": 2.59 | |
| }, | |
| { | |
| "text": "I could make this a\nlittle better designed to.", | |
| "start": 2848.93, | |
| "duration": 2.45 | |
| }, | |
| { | |
| "text": "Let me go back to some slides and\nshow you we could use these keywords", | |
| "start": 2851.38, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "BETWEEN blank AND blank, where\nthis can be some condition", | |
| "start": 2854.59, | |
| "duration": 4.92 | |
| }, | |
| { | |
| "text": "or some number in this case.", | |
| "start": 2859.51, | |
| "duration": 1.72 | |
| }, | |
| { | |
| "text": "I could say between,\nlet's say, 2019 AND 2022.", | |
| "start": 2861.23, | |
| "duration": 5.09 | |
| }, | |
| { | |
| "text": "This is inclusive.", | |
| "start": 2866.32, | |
| "duration": 1.42 | |
| }, | |
| { | |
| "text": "So if I say 2019 AND 2022, I'll get back\na query that includes 2019 and 2022.", | |
| "start": 2867.74, | |
| "duration": 8.54 | |
| }, | |
| { | |
| "text": "So let me try this one.", | |
| "start": 2876.28, | |
| "duration": 1.62 | |
| }, | |
| { | |
| "text": "I'll go back over here.", | |
| "start": 2877.9, | |
| "duration": 1.23 | |
| }, | |
| { | |
| "text": "And I will now try\nSELECT \"title\" and \"year\"", | |
| "start": 2879.13, | |
| "duration": 5.04 | |
| }, | |
| { | |
| "text": "from \"longlist,\" WHERE the\n\"year\" is between 2019 AND 2022.", | |
| "start": 2884.17, | |
| "duration": 8.2 | |
| }, | |
| { | |
| "text": "Same results now, which is a different\nway of writing this same query.", | |
| "start": 2892.37, | |
| "duration": 5.62 | |
| }, | |
| { | |
| "text": "Now what else can we\ndo with these ranges?", | |
| "start": 2897.99, | |
| "duration": 3.13 | |
| }, | |
| { | |
| "text": "Well, as we've said before, these books\nactually have some ratings involved.", | |
| "start": 2901.12, | |
| "duration": 5.36 | |
| }, | |
| { | |
| "text": "These ratings are\ncrowdsourced from Goodreads,", | |
| "start": 2906.48, | |
| "duration": 2.55 | |
| }, | |
| { | |
| "text": "a site you can review books online.", | |
| "start": 2909.03, | |
| "duration": 2.37 | |
| }, | |
| { | |
| "text": "And I want to find maybe the books\nthat have a rating of 4.0 or higher.", | |
| "start": 2911.4, | |
| "duration": 4.17 | |
| }, | |
| { | |
| "text": "Well, I could do that now with my ranges\nI could say SELECT \"title\" and \"rating\"", | |
| "start": 2915.57, | |
| "duration": 5.7 | |
| }, | |
| { | |
| "text": "from my \"longlist.\"", | |
| "start": 2921.27, | |
| "duration": 1.74 | |
| }, | |
| { | |
| "text": "And I could say WHERE the \"rating\"\nis greater than 4.0 Semicolon.", | |
| "start": 2923.01, | |
| "duration": 5.91 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 2928.92, | |
| "duration": 1.02 | |
| }, | |
| { | |
| "text": "And I'll see now only those\nbooks that have a rating of 4.0", | |
| "start": 2929.94, | |
| "duration": 5.16 | |
| }, | |
| { | |
| "text": "or higher like this.", | |
| "start": 2935.1, | |
| "duration": 3.56 | |
| }, | |
| { | |
| "text": "I could even combine conditions.", | |
| "start": 2938.66, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "So I know that these books\nhave a certain rating,", | |
| "start": 2940.97, | |
| "duration": 2.54 | |
| }, | |
| { | |
| "text": "but how many votes do they really get?", | |
| "start": 2943.51, | |
| "duration": 2.22 | |
| }, | |
| { | |
| "text": "Well, let's take a peek.", | |
| "start": 2945.73, | |
| "duration": 1.48 | |
| }, | |
| { | |
| "text": "I'll come back over here.", | |
| "start": 2947.21, | |
| "duration": 1.25 | |
| }, | |
| { | |
| "text": "And let me try this one.", | |
| "start": 2948.46, | |
| "duration": 2.34 | |
| }, | |
| { | |
| "text": "I could say SELECT \"title.\"", | |
| "start": 2950.8, | |
| "duration": 2.98 | |
| }, | |
| { | |
| "text": "Oops, let me clear my terminal\nagain so it's back up top.", | |
| "start": 2953.78, | |
| "duration": 3.34 | |
| }, | |
| { | |
| "text": "SELECT \"title\" and\n\"rating\" and the number of", | |
| "start": 2957.12, | |
| "duration": 5.76 | |
| }, | |
| { | |
| "text": "votes that these books got from,\nlet's say, our \"longlist\" table.", | |
| "start": 2962.88, | |
| "duration": 5.16 | |
| }, | |
| { | |
| "text": "Now, I want to find those that\nhave a rating of greater than 4.0,", | |
| "start": 2968.04, | |
| "duration": 6.36 | |
| }, | |
| { | |
| "text": "and, let's say, a number of votes--", | |
| "start": 2974.4, | |
| "duration": 4.28 | |
| }, | |
| { | |
| "text": "a number of votes which\nis greater than at least--", | |
| "start": 2978.68, | |
| "duration": 2.4 | |
| }, | |
| { | |
| "text": "let's go with 10,000.", | |
| "start": 2981.08, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "So at least we know a good number of\nfolks actually voted on these books", | |
| "start": 2983.33, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "to find the best among them.", | |
| "start": 2986.96, | |
| "duration": 2.01 | |
| }, | |
| { | |
| "text": "I'll Enter.", | |
| "start": 2988.97, | |
| "duration": 1.02 | |
| }, | |
| { | |
| "text": "And now I'll see we're\nonly down to a few books,", | |
| "start": 2989.99, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "four in fact, where each one\nhas a rating higher than 4.0.", | |
| "start": 2993.62, | |
| "duration": 4.65 | |
| }, | |
| { | |
| "text": "And indeed, every vote row has a vote\ntotal greater than 10,000 in this case.", | |
| "start": 2998.27, | |
| "duration": 8.22 | |
| }, | |
| { | |
| "text": "So a good way to try to find the\ntop books in our data set here.", | |
| "start": 3006.49, | |
| "duration": 5.61 | |
| }, | |
| { | |
| "text": "Let's keep going with these ranges.", | |
| "start": 3012.1, | |
| "duration": 1.82 | |
| }, | |
| { | |
| "text": "And let's think about one\nmore thing we could do.", | |
| "start": 3013.92, | |
| "duration": 3.27 | |
| }, | |
| { | |
| "text": "Maybe I want to find books that\nare less than a certain length.", | |
| "start": 3017.19, | |
| "duration": 2.85 | |
| }, | |
| { | |
| "text": "So I'll try that as well.", | |
| "start": 3020.04, | |
| "duration": 1.65 | |
| }, | |
| { | |
| "text": "I'll say SELECT, let's say, \"title\"\nand \"pages\" from my \"longlist.\"", | |
| "start": 3021.69, | |
| "duration": 5.49 | |
| }, | |
| { | |
| "text": "And now I can make a\ncondition based on pages.", | |
| "start": 3027.18, | |
| "duration": 2.82 | |
| }, | |
| { | |
| "text": "I'll say WHERE \"pages\" is less than 300.", | |
| "start": 3030.0, | |
| "duration": 3.69 | |
| }, | |
| { | |
| "text": "Hit Enter.", | |
| "start": 3033.69, | |
| "duration": 1.11 | |
| }, | |
| { | |
| "text": "And now I should see that\nI have all these books that", | |
| "start": 3034.8, | |
| "duration": 3.0 | |
| }, | |
| { | |
| "text": "are less than 300 pages long\nwhen they were first published.", | |
| "start": 3037.8, | |
| "duration": 5.47 | |
| }, | |
| { | |
| "text": "So let's pause here\nand ask what questions", | |
| "start": 3043.27, | |
| "duration": 2.06 | |
| }, | |
| { | |
| "text": "we have on these range conditions.", | |
| "start": 3045.33, | |
| "duration": 3.69 | |
| }, | |
| { | |
| "text": "SPEAKER: I just wanted to check\nif for a proper query in this case", | |
| "start": 3049.02, | |
| "duration": 6.21 | |
| }, | |
| { | |
| "text": "to be able to run operations, they\nhave to be integers in the database.", | |
| "start": 3055.23, | |
| "duration": 5.01 | |
| }, | |
| { | |
| "text": "And my second question is for\nwhen we're matching a string,", | |
| "start": 3060.24, | |
| "duration": 3.84 | |
| }, | |
| { | |
| "text": "is it case-sensitive or not?", | |
| "start": 3064.08, | |
| "duration": 2.123 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah, two great questions.", | |
| "start": 3066.203, | |
| "duration": 1.667 | |
| }, | |
| { | |
| "text": "So the first one here is going to be,\ndo I have to use integers in this case?", | |
| "start": 3067.87, | |
| "duration": 4.65 | |
| }, | |
| { | |
| "text": "And what types, maybe, should I use?", | |
| "start": 3072.52, | |
| "duration": 1.79 | |
| }, | |
| { | |
| "text": "And the second one being, could I\nmatch strings like case insensitively?", | |
| "start": 3074.31, | |
| "duration": 3.54 | |
| }, | |
| { | |
| "text": "So for the first one,\nin this case, it'll", | |
| "start": 3077.85, | |
| "duration": 3.09 | |
| }, | |
| { | |
| "text": "depend on the design of your database.", | |
| "start": 3080.94, | |
| "duration": 2.17 | |
| }, | |
| { | |
| "text": "So we'll see later on\nin the course, how we", | |
| "start": 3083.11, | |
| "duration": 2.03 | |
| }, | |
| { | |
| "text": "can choose the types for our columns.", | |
| "start": 3085.14, | |
| "duration": 2.28 | |
| }, | |
| { | |
| "text": "And how that might impact the types\nwe actually use in our queries.", | |
| "start": 3087.42, | |
| "duration": 3.84 | |
| }, | |
| { | |
| "text": "For now, I made this database.", | |
| "start": 3091.26, | |
| "duration": 2.14 | |
| }, | |
| { | |
| "text": "So I just know that my\nyear column is an integer,", | |
| "start": 3093.4, | |
| "duration": 3.35 | |
| }, | |
| { | |
| "text": "my ratings column is a real number\nor a float, if you're familiar,", | |
| "start": 3096.75, | |
| "duration": 3.27 | |
| }, | |
| { | |
| "text": "and my votes is an integer.", | |
| "start": 3100.02, | |
| "duration": 1.54 | |
| }, | |
| { | |
| "text": "So I just know to use\nthose numbers there.", | |
| "start": 3101.56, | |
| "duration": 2.24 | |
| }, | |
| { | |
| "text": "To the question of matching\nthings case-insensitively,", | |
| "start": 3103.8, | |
| "duration": 3.66 | |
| }, | |
| { | |
| "text": "let's actually revisit LIKE just briefly\nhere to show you what that can do.", | |
| "start": 3107.46, | |
| "duration": 3.36 | |
| }, | |
| { | |
| "text": "So I go back to my terminal, and let's\nsay I want to find just a book title.", | |
| "start": 3110.82, | |
| "duration": 7.34 | |
| }, | |
| { | |
| "text": "And I want to type it\nin kind of sloppily.", | |
| "start": 3118.16, | |
| "duration": 1.75 | |
| }, | |
| { | |
| "text": "I don't want to capitalize\nit like capital books are.", | |
| "start": 3119.91, | |
| "duration": 2.208 | |
| }, | |
| { | |
| "text": "So I'll say SELECT let's\nsay \"title\" from \"longlist.\"", | |
| "start": 3122.118, | |
| "duration": 4.632 | |
| }, | |
| { | |
| "text": "And maybe, I'll want to\nfind that book Pyre again.", | |
| "start": 3126.75, | |
| "duration": 4.18 | |
| }, | |
| { | |
| "text": "So I could say WHERE \"title\" is\nLIKE 'pyre', but all in lowercase.", | |
| "start": 3130.93, | |
| "duration": 6.78 | |
| }, | |
| { | |
| "text": "Now I'll hit Enter.", | |
| "start": 3137.71, | |
| "duration": 1.4 | |
| }, | |
| { | |
| "text": "And I'll see I do get back Pyre.", | |
| "start": 3139.11, | |
| "duration": 2.43 | |
| }, | |
| { | |
| "text": "So even though I said WHERE \"title\"\nis LIKE lowercase 'pyre', I got back", | |
| "start": 3141.54, | |
| "duration": 5.97 | |
| }, | |
| { | |
| "text": "capital Pyre.", | |
| "start": 3147.51, | |
| "duration": 2.37 | |
| }, | |
| { | |
| "text": "Now this is in contrast to saying\nWHERE \"title\" equals lowercase 'pyre'.", | |
| "start": 3149.88, | |
| "duration": 5.22 | |
| }, | |
| { | |
| "text": "Let's try that.", | |
| "start": 3155.1, | |
| "duration": 1.51 | |
| }, | |
| { | |
| "text": "I'll come back over here.", | |
| "start": 3156.61, | |
| "duration": 1.22 | |
| }, | |
| { | |
| "text": "And I'll say again SELECT\n\"title\" from \"longlist,\"", | |
| "start": 3157.83, | |
| "duration": 5.73 | |
| }, | |
| { | |
| "text": "but now WHERE \"title\" equals,\nquote, unquote, 'pyre' Semicolon.", | |
| "start": 3163.56, | |
| "duration": 9.27 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 3172.83, | |
| "duration": 0.96 | |
| }, | |
| { | |
| "text": "And now I see no results.", | |
| "start": 3173.79, | |
| "duration": 1.78 | |
| }, | |
| { | |
| "text": "So in this case, the equal is\ngoing to be case-sensitive.", | |
| "start": 3175.57, | |
| "duration": 3.44 | |
| }, | |
| { | |
| "text": "Case matters in this case,\nbut LIKE is case-insensitive.", | |
| "start": 3179.01, | |
| "duration": 6.31 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 3185.32, | |
| "duration": 1.67 | |
| }, | |
| { | |
| "text": "Why don't we keep going then?", | |
| "start": 3186.99, | |
| "duration": 2.858 | |
| }, | |
| { | |
| "text": "And let's take a look\nat a few other things", | |
| "start": 3189.848, | |
| "duration": 1.792 | |
| }, | |
| { | |
| "text": "we can do with these SQL\nkeywords for querying.", | |
| "start": 3191.64, | |
| "duration": 3.81 | |
| }, | |
| { | |
| "text": "Well, earlier, we were\ntrying to find a way", | |
| "start": 3195.45, | |
| "duration": 2.79 | |
| }, | |
| { | |
| "text": "to find the best books in our data set.", | |
| "start": 3198.24, | |
| "duration": 3.24 | |
| }, | |
| { | |
| "text": "And we did that by filtering\nthem based on some ranges.", | |
| "start": 3201.48, | |
| "duration": 3.33 | |
| }, | |
| { | |
| "text": "But we could probably do\nthat a little bit more", | |
| "start": 3204.81, | |
| "duration": 2.4 | |
| }, | |
| { | |
| "text": "methodically in this case using a new\nkeyword, this one called ORDER BY.", | |
| "start": 3207.21, | |
| "duration": 5.97 | |
| }, | |
| { | |
| "text": "So ORDER BY allows us to\ntake the results of our query", | |
| "start": 3213.18, | |
| "duration": 4.8 | |
| }, | |
| { | |
| "text": "and order them, as it suggests,\nby some column itself.", | |
| "start": 3217.98, | |
| "duration": 5.02 | |
| }, | |
| { | |
| "text": "So we could put them in alphabetical\norder or in order by a number of votes", | |
| "start": 3223.0, | |
| "duration": 4.67 | |
| }, | |
| { | |
| "text": "or in order by number of ratings.", | |
| "start": 3227.67, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "And let's just try an example of this\nto see how ORDER BY works for us.", | |
| "start": 3230.34, | |
| "duration": 4.02 | |
| }, | |
| { | |
| "text": "But in the end, we'll see it can\narrange columns, arrange rows for us", | |
| "start": 3234.36, | |
| "duration": 4.35 | |
| }, | |
| { | |
| "text": "in our resulting query.", | |
| "start": 3238.71, | |
| "duration": 1.72 | |
| }, | |
| { | |
| "text": "So I'll go back to my computer.", | |
| "start": 3240.43, | |
| "duration": 2.36 | |
| }, | |
| { | |
| "text": "And let's try this question here.", | |
| "start": 3242.79, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "I want to try to find the\ntop 10 books in my table.", | |
| "start": 3244.83, | |
| "duration": 4.57 | |
| }, | |
| { | |
| "text": "So I'll say SELECT \"title\"\nand \"rating\" from \"longlist.\"", | |
| "start": 3249.4, | |
| "duration": 7.48 | |
| }, | |
| { | |
| "text": "Enter.", | |
| "start": 3256.88, | |
| "duration": 1.2 | |
| }, | |
| { | |
| "text": "Not only query yet though.", | |
| "start": 3258.08, | |
| "duration": 1.74 | |
| }, | |
| { | |
| "text": "Now I'll say ORDER BY the rating.", | |
| "start": 3259.82, | |
| "duration": 4.82 | |
| }, | |
| { | |
| "text": "And let's only take the top 10.", | |
| "start": 3264.64, | |
| "duration": 2.16 | |
| }, | |
| { | |
| "text": "So I'll say limit 10 in\nthis instance Semicolon.", | |
| "start": 3266.8, | |
| "duration": 4.32 | |
| }, | |
| { | |
| "text": "So now I've combined some\nof my prior keywords.", | |
| "start": 3271.12, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "I'm using SELECT.", | |
| "start": 3274.33, | |
| "duration": 1.17 | |
| }, | |
| { | |
| "text": "I'm using ORDER BY.", | |
| "start": 3275.5, | |
| "duration": 1.29 | |
| }, | |
| { | |
| "text": "And I'm still using\nour old friend LIMIT.", | |
| "start": 3276.79, | |
| "duration": 2.05 | |
| }, | |
| { | |
| "text": "So let me hit Enter here.", | |
| "start": 3278.84, | |
| "duration": 1.85 | |
| }, | |
| { | |
| "text": "And I'll get back, well,\nnot quite the top 10.", | |
| "start": 3280.69, | |
| "duration": 5.36 | |
| }, | |
| { | |
| "text": "I see rating of 3.05 here\nand rating of 3.42 down here.", | |
| "start": 3286.05, | |
| "duration": 6.19 | |
| }, | |
| { | |
| "text": "So based on this, what do you think\nthe default ordering of ORDER BY is?", | |
| "start": 3292.24, | |
| "duration": 7.76 | |
| }, | |
| { | |
| "text": "So you might be from least to greatest.", | |
| "start": 3300.0, | |
| "duration": 2.02 | |
| }, | |
| { | |
| "text": "So we saw here that we have\nrating being pretty small,", | |
| "start": 3302.02, | |
| "duration": 3.41 | |
| }, | |
| { | |
| "text": "but we said ORDER BY our rating.", | |
| "start": 3305.43, | |
| "duration": 1.71 | |
| }, | |
| { | |
| "text": "So it starts from small\nand goes down to large.", | |
| "start": 3307.14, | |
| "duration": 3.3 | |
| }, | |
| { | |
| "text": "So we need to fix this in some way.", | |
| "start": 3310.44, | |
| "duration": 1.98 | |
| }, | |
| { | |
| "text": "And let's introduce a\nnew addition to ORDER BY", | |
| "start": 3312.42, | |
| "duration": 2.82 | |
| }, | |
| { | |
| "text": "to have us fix this query overall.", | |
| "start": 3315.24, | |
| "duration": 3.58 | |
| }, | |
| { | |
| "text": "So let me show you that ORDER BY does\nby default sort from least to greatest.", | |
| "start": 3318.82, | |
| "duration": 6.11 | |
| }, | |
| { | |
| "text": "But let's try some addition here.", | |
| "start": 3324.93, | |
| "duration": 2.64 | |
| }, | |
| { | |
| "text": "We have not just ORDER BY\nbut ORDER BY some column", | |
| "start": 3327.57, | |
| "duration": 4.26 | |
| }, | |
| { | |
| "text": "and then ascending or descending.", | |
| "start": 3331.83, | |
| "duration": 3.7 | |
| }, | |
| { | |
| "text": "So ascending is the default. It\nmeans from least to greatest.", | |
| "start": 3335.53, | |
| "duration": 3.95 | |
| }, | |
| { | |
| "text": "Descending, we can specify\nmeaning from greatest to smallest.", | |
| "start": 3339.48, | |
| "duration": 4.78 | |
| }, | |
| { | |
| "text": "So let's try using ORDER BY\nbut now with this other keyword", | |
| "start": 3344.26, | |
| "duration": 3.05 | |
| }, | |
| { | |
| "text": "called DESC for descending here.", | |
| "start": 3347.31, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "I'll go back to my terminal.", | |
| "start": 3350.52, | |
| "duration": 3.24 | |
| }, | |
| { | |
| "text": "And let's rewrite this\nquery to include DESC.", | |
| "start": 3353.76, | |
| "duration": 3.45 | |
| }, | |
| { | |
| "text": "I'll say SELECT \"title\" and\n\"rating\" from \"longlist.\"", | |
| "start": 3357.21, | |
| "duration": 5.49 | |
| }, | |
| { | |
| "text": "And let me-- before\nI run this query, let", | |
| "start": 3362.7, | |
| "duration": 1.932 | |
| }, | |
| { | |
| "text": "me just clear my terminal\nso it's back up at the top.", | |
| "start": 3364.632, | |
| "duration": 2.208 | |
| }, | |
| { | |
| "text": "I'll backspace this.", | |
| "start": 3366.84, | |
| "duration": 1.74 | |
| }, | |
| { | |
| "text": "And then a moment here, I'll press\nControl-L. Now I'm back at the top.", | |
| "start": 3368.58, | |
| "duration": 4.47 | |
| }, | |
| { | |
| "text": "I'll say SELECT \"title\", SELECT \"title\"\nand \"rating\" from \"longlist\" WHERE--", | |
| "start": 3373.05, | |
| "duration": 8.797 | |
| }, | |
| { | |
| "text": "actually, not WHERE.", | |
| "start": 3381.847, | |
| "duration": 0.833 | |
| }, | |
| { | |
| "text": "We're not filtering yet.", | |
| "start": 3382.68, | |
| "duration": 1.14 | |
| }, | |
| { | |
| "text": "I'll say ORDER BY rating but\nnot by ascending by default--", | |
| "start": 3383.82, | |
| "duration": 6.262 | |
| }, | |
| { | |
| "text": "going from least to greatest.", | |
| "start": 3390.082, | |
| "duration": 1.208 | |
| }, | |
| { | |
| "text": "I want greatest to least.", | |
| "start": 3391.29, | |
| "duration": 1.72 | |
| }, | |
| { | |
| "text": "So I'll say DESC here.", | |
| "start": 3393.01, | |
| "duration": 2.36 | |
| }, | |
| { | |
| "text": "Now, I can say LIMIT 10 Semicolon.", | |
| "start": 3395.37, | |
| "duration": 3.51 | |
| }, | |
| { | |
| "text": "Hit Enter.", | |
| "start": 3398.88, | |
| "duration": 0.96 | |
| }, | |
| { | |
| "text": "And now I'll see the top 10 books.", | |
| "start": 3399.84, | |
| "duration": 2.7 | |
| }, | |
| { | |
| "text": "Here, I have The Eighth Life coming\nin at 4.52 and The Books of Jacob", | |
| "start": 3402.54, | |
| "duration": 4.62 | |
| }, | |
| { | |
| "text": "coming in at 4.06.", | |
| "start": 3407.16, | |
| "duration": 2.52 | |
| }, | |
| { | |
| "text": "So now we're going from\ngreatest to smallest.", | |
| "start": 3409.68, | |
| "duration": 3.78 | |
| }, | |
| { | |
| "text": "Well, I could order by\nnot just these ratings,", | |
| "start": 3413.46, | |
| "duration": 3.42 | |
| }, | |
| { | |
| "text": "but also by the number of votes.", | |
| "start": 3416.88, | |
| "duration": 2.34 | |
| }, | |
| { | |
| "text": "It seems there's a tie to break here.", | |
| "start": 3419.22, | |
| "duration": 1.68 | |
| }, | |
| { | |
| "text": "If I look at Still Born and When\nWe Cease to Understand the World,", | |
| "start": 3420.9, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "those both have a rating of 4.14.", | |
| "start": 3424.89, | |
| "duration": 2.91 | |
| }, | |
| { | |
| "text": "But presumably, one book has\nmaybe more votes than the other.", | |
| "start": 3427.8, | |
| "duration": 4.63 | |
| }, | |
| { | |
| "text": "So I could try to break this tie by\nordering not just by rating but also", | |
| "start": 3432.43, | |
| "duration": 5.93 | |
| }, | |
| { | |
| "text": "by votes, the number votes this book\nactually received on Good Reads.", | |
| "start": 3438.36, | |
| "duration": 4.17 | |
| }, | |
| { | |
| "text": "So let's try that then\nto break this tie.", | |
| "start": 3442.53, | |
| "duration": 2.76 | |
| }, | |
| { | |
| "text": "I'll come back over here.", | |
| "start": 3445.29, | |
| "duration": 1.44 | |
| }, | |
| { | |
| "text": "And I'll try this query now.", | |
| "start": 3446.73, | |
| "duration": 2.76 | |
| }, | |
| { | |
| "text": "I'll say, again, SELECT \"title\"\nand \"rating\" from \"longlist.\"", | |
| "start": 3449.49, | |
| "duration": 6.3 | |
| }, | |
| { | |
| "text": "Now I'll order by, first, the\nrating column in descending order.", | |
| "start": 3455.79, | |
| "duration": 6.07 | |
| }, | |
| { | |
| "text": "But I also want to order by the number\nof votes after I order by rating.", | |
| "start": 3461.86, | |
| "duration": 5.24 | |
| }, | |
| { | |
| "text": "So I'm saying first order\nby rating, but afterwards,", | |
| "start": 3467.1, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "followed by a comma, let's\norder by the number of votes", | |
| "start": 3470.73, | |
| "duration": 3.48 | |
| }, | |
| { | |
| "text": "also in descending order--\nfrom greatest to smallest.", | |
| "start": 3474.21, | |
| "duration": 4.29 | |
| }, | |
| { | |
| "text": "Now I'll just continue my\nquery on the next line.", | |
| "start": 3478.5, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "And I'll say LIMIT 10 Semicolon.", | |
| "start": 3481.17, | |
| "duration": 2.91 | |
| }, | |
| { | |
| "text": "This then gives me, let's\nsee, the books but now", | |
| "start": 3484.08, | |
| "duration": 5.04 | |
| }, | |
| { | |
| "text": "they're going to be in the order that\nallows us to see the number of votes.", | |
| "start": 3489.12, | |
| "duration": 3.85 | |
| }, | |
| { | |
| "text": "Let me just actually refine this.", | |
| "start": 3492.97, | |
| "duration": 1.41 | |
| }, | |
| { | |
| "text": "Let me say not just title\nand rating, let's make", | |
| "start": 3494.38, | |
| "duration": 2.732 | |
| }, | |
| { | |
| "text": "sure we can see the votes here too.", | |
| "start": 3497.112, | |
| "duration": 1.458 | |
| }, | |
| { | |
| "text": "So SELECT \"title\" and \"rating\"\nand \"votes\" from \"longlist.\"", | |
| "start": 3498.57, | |
| "duration": 5.01 | |
| }, | |
| { | |
| "text": "Hit Enter on my query.", | |
| "start": 3503.58, | |
| "duration": 1.23 | |
| }, | |
| { | |
| "text": "Now I'll say ORDER BY\n\"rating\" and \"votes.\"", | |
| "start": 3504.81, | |
| "duration": 2.94 | |
| }, | |
| { | |
| "text": "Then I'll say LIMIT 10.", | |
| "start": 3507.75, | |
| "duration": 1.8 | |
| }, | |
| { | |
| "text": "And here, I'm just getting\nthe Up Arrow on my computer.", | |
| "start": 3509.55, | |
| "duration": 2.61 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 3512.16, | |
| "duration": 1.5 | |
| }, | |
| { | |
| "text": "And now I'll see the votes included.", | |
| "start": 3513.66, | |
| "duration": 2.49 | |
| }, | |
| { | |
| "text": "So let me show you\nthis on the big screen.", | |
| "start": 3516.15, | |
| "duration": 1.92 | |
| }, | |
| { | |
| "text": "Here, we see that the tie is broken.", | |
| "start": 3518.07, | |
| "duration": 2.37 | |
| }, | |
| { | |
| "text": "So when we cease to\nunderstand the world,", | |
| "start": 3520.44, | |
| "duration": 2.16 | |
| }, | |
| { | |
| "text": "these both have 4.14\nalong with Still Born.", | |
| "start": 3522.6, | |
| "duration": 3.96 | |
| }, | |
| { | |
| "text": "But here, this book has more votes\nand so is higher in our order", | |
| "start": 3526.56, | |
| "duration": 4.98 | |
| }, | |
| { | |
| "text": "now that we've ordered\nby multiple columns.", | |
| "start": 3531.54, | |
| "duration": 4.37 | |
| }, | |
| { | |
| "text": "So let me pause here\nand ask what questions", | |
| "start": 3535.91, | |
| "duration": 2.33 | |
| }, | |
| { | |
| "text": "we have on ordering with data.", | |
| "start": 3538.24, | |
| "duration": 3.39 | |
| }, | |
| { | |
| "text": "Ordering by one column or multiple,\nand how we can sort data like this.", | |
| "start": 3541.63, | |
| "duration": 5.85 | |
| }, | |
| { | |
| "text": "SPEAKER: Sir, I want to know that\ncan we write rating to 4.93 to 4.9?", | |
| "start": 3547.48, | |
| "duration": 6.875 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah good question.", | |
| "start": 3554.355, | |
| "duration": 1.375 | |
| }, | |
| { | |
| "text": "I think if I understand you\ncorrectly, how can we select a rating", | |
| "start": 3555.73, | |
| "duration": 2.85 | |
| }, | |
| { | |
| "text": "or try to find a rating that's like\nequal to 4.92 or things like that.", | |
| "start": 3558.58, | |
| "duration": 4.24 | |
| }, | |
| { | |
| "text": "Let's try that here.", | |
| "start": 3562.82, | |
| "duration": 0.96 | |
| }, | |
| { | |
| "text": "So if I want to find\na particular rating,", | |
| "start": 3563.78, | |
| "duration": 2.57 | |
| }, | |
| { | |
| "text": "I could simply use my\nWHERE friend from before.", | |
| "start": 3566.35, | |
| "duration": 3.9 | |
| }, | |
| { | |
| "text": "I could say SELECT, let's\nsay, \"title\" and \"rating.\"", | |
| "start": 3570.25, | |
| "duration": 4.14 | |
| }, | |
| { | |
| "text": "And maybe I could try to find\na particular rating for a book", | |
| "start": 3574.39, | |
| "duration": 3.36 | |
| }, | |
| { | |
| "text": "from longlist.", | |
| "start": 3577.75, | |
| "duration": 1.65 | |
| }, | |
| { | |
| "text": "I could say then WHERE this rating is\nequal to, let's say, 4.932 Semicolon.", | |
| "start": 3579.4, | |
| "duration": 7.47 | |
| }, | |
| { | |
| "text": "If this book exists, it\nwill get it back here.", | |
| "start": 3586.87, | |
| "duration": 2.29 | |
| }, | |
| { | |
| "text": "So I'll hit Enter.", | |
| "start": 3589.16, | |
| "duration": 1.01 | |
| }, | |
| { | |
| "text": "And I see there's no book with\nthis particular rating, 4.392.", | |
| "start": 3590.17, | |
| "duration": 5.64 | |
| }, | |
| { | |
| "text": "But good question for how to find\nparticular ratings for our books here.", | |
| "start": 3595.81, | |
| "duration": 5.7 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 3601.51, | |
| "duration": 0.87 | |
| }, | |
| { | |
| "text": "Other questions too on how we've been\nable to sort our data and use ORDER BY?", | |
| "start": 3602.38, | |
| "duration": 6.75 | |
| }, | |
| { | |
| "text": "SPEAKER: Will descend work on a\nstring on an alphabetic basis?", | |
| "start": 3609.13, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "Or do we need to have special\nconditions for alphabetic characters?", | |
| "start": 3613.0, | |
| "duration": 5.098 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah, a great question.", | |
| "start": 3618.098, | |
| "duration": 1.542 | |
| }, | |
| { | |
| "text": "So how could we use ORDER BY with some\ncharacters or strings or some text", | |
| "start": 3619.64, | |
| "duration": 4.1 | |
| }, | |
| { | |
| "text": "in our database?", | |
| "start": 3623.74, | |
| "duration": 0.85 | |
| }, | |
| { | |
| "text": "Let's try that one out too and\nsee how that works with ASC", | |
| "start": 3624.59, | |
| "duration": 3.2 | |
| }, | |
| { | |
| "text": "for ascending and DESC for descending.", | |
| "start": 3627.79, | |
| "duration": 2.97 | |
| }, | |
| { | |
| "text": "So I'll go back to my terminal.", | |
| "start": 3630.76, | |
| "duration": 1.59 | |
| }, | |
| { | |
| "text": "And I'll demonstrate here how\nwe can use this for some text.", | |
| "start": 3632.35, | |
| "duration": 3.36 | |
| }, | |
| { | |
| "text": "So let's try to simply sorting our\nbooks alphabetically for, let's say,", | |
| "start": 3635.71, | |
| "duration": 5.07 | |
| }, | |
| { | |
| "text": "our library.", | |
| "start": 3640.78, | |
| "duration": 1.02 | |
| }, | |
| { | |
| "text": "I'll say SELECT \"title\"\nfrom \"longlist,\" Enter.", | |
| "start": 3641.8, | |
| "duration": 5.1 | |
| }, | |
| { | |
| "text": "And I want to order by\ntitle, just plain and simple.", | |
| "start": 3646.9, | |
| "duration": 3.31 | |
| }, | |
| { | |
| "text": "And then hit Semicolon.", | |
| "start": 3650.21, | |
| "duration": 1.38 | |
| }, | |
| { | |
| "text": "Let's see what happens.", | |
| "start": 3651.59, | |
| "duration": 1.16 | |
| }, | |
| { | |
| "text": "I'll hit Enter.", | |
| "start": 3652.75, | |
| "duration": 1.41 | |
| }, | |
| { | |
| "text": "And now I'll see that\nthese books are ordered.", | |
| "start": 3654.16, | |
| "duration": 3.54 | |
| }, | |
| { | |
| "text": "But they seem to be\nordered alphabetically.", | |
| "start": 3657.7, | |
| "duration": 2.28 | |
| }, | |
| { | |
| "text": "So here, we have some titles\nlower in the alphabet.", | |
| "start": 3659.98, | |
| "duration": 3.72 | |
| }, | |
| { | |
| "text": "And up here, we have titles\nearlier in the alphabet.", | |
| "start": 3663.7, | |
| "duration": 2.62 | |
| }, | |
| { | |
| "text": "So by default ORDER BY seems\nto order alphabetically.", | |
| "start": 3666.32, | |
| "duration": 4.46 | |
| }, | |
| { | |
| "text": "If I change that default, though,\nfrom ascending to descending,", | |
| "start": 3670.78, | |
| "duration": 4.29 | |
| }, | |
| { | |
| "text": "let's see what happens.", | |
| "start": 3675.07, | |
| "duration": 1.89 | |
| }, | |
| { | |
| "text": "I'll go back over here.", | |
| "start": 3676.96, | |
| "duration": 1.29 | |
| }, | |
| { | |
| "text": "And I'll try the same\nquery but now using DESC.", | |
| "start": 3678.25, | |
| "duration": 4.74 | |
| }, | |
| { | |
| "text": "SELECT \"title\" from \"longlist.\"", | |
| "start": 3682.99, | |
| "duration": 1.77 | |
| }, | |
| { | |
| "text": "ORDER BY \"title\" now\nin descending order.", | |
| "start": 3684.76, | |
| "duration": 4.35 | |
| }, | |
| { | |
| "text": "Hit Enter.", | |
| "start": 3689.11, | |
| "duration": 1.29 | |
| }, | |
| { | |
| "text": "And now I'll see these titles\nin reverse alphabetical order.", | |
| "start": 3690.4, | |
| "duration": 4.23 | |
| }, | |
| { | |
| "text": "So notice how earlier on, we have\ntitles that are lower in the alphabet.", | |
| "start": 3694.63, | |
| "duration": 4.56 | |
| }, | |
| { | |
| "text": "But down below, we have titles that\nare earlier in the alphabet here.", | |
| "start": 3699.19, | |
| "duration": 3.55 | |
| }, | |
| { | |
| "text": "So you can use ORDER\nBY with these texts.", | |
| "start": 3702.74, | |
| "duration": 3.59 | |
| }, | |
| { | |
| "text": "But you then have to specify whether\nyou want it in alphabetical order", | |
| "start": 3706.33, | |
| "duration": 3.36 | |
| }, | |
| { | |
| "text": "or in reverse alphabetical order.", | |
| "start": 3709.69, | |
| "duration": 4.27 | |
| }, | |
| { | |
| "text": "OK, so let's show a\nfew other concepts here", | |
| "start": 3713.96, | |
| "duration": 4.74 | |
| }, | |
| { | |
| "text": "we can use alongside of these orderings.", | |
| "start": 3718.7, | |
| "duration": 3.04 | |
| }, | |
| { | |
| "text": "One thing we could also do is\ntry to find more information", | |
| "start": 3721.74, | |
| "duration": 4.34 | |
| }, | |
| { | |
| "text": "about the ratings of these books.", | |
| "start": 3726.08, | |
| "duration": 1.77 | |
| }, | |
| { | |
| "text": "So let's say I want not\njust to order these books", | |
| "start": 3727.85, | |
| "duration": 3.12 | |
| }, | |
| { | |
| "text": "but try to find the average rating,\nor to try to find the number of books,", | |
| "start": 3730.97, | |
| "duration": 4.74 | |
| }, | |
| { | |
| "text": "or try to find let's say maybe the sum\nof my total votes on each of my books.", | |
| "start": 3735.71, | |
| "duration": 5.37 | |
| }, | |
| { | |
| "text": "Well, for this, we could\nintroduce some new concepts,", | |
| "start": 3741.08, | |
| "duration": 3.78 | |
| }, | |
| { | |
| "text": "these ones called SQL's\naggregate functions.", | |
| "start": 3744.86, | |
| "duration": 4.2 | |
| }, | |
| { | |
| "text": "These allow us to take a whole set of\nrows and return not each of those rows", | |
| "start": 3749.06, | |
| "duration": 6.33 | |
| }, | |
| { | |
| "text": "individually.", | |
| "start": 3755.39, | |
| "duration": 1.17 | |
| }, | |
| { | |
| "text": "But instead, in this case, one number\nbased on the values in those rows.", | |
| "start": 3756.56, | |
| "duration": 5.73 | |
| }, | |
| { | |
| "text": "You could imagine trying to\ncount the number of rows you have", | |
| "start": 3762.29, | |
| "duration": 3.06 | |
| }, | |
| { | |
| "text": "or take the average\nof the number of rows,", | |
| "start": 3765.35, | |
| "duration": 2.61 | |
| }, | |
| { | |
| "text": "or take the average of let's\nsay a rating, for instance.", | |
| "start": 3767.96, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "Finding the minimum rating\nof the maximum rating", | |
| "start": 3770.63, | |
| "duration": 2.07 | |
| }, | |
| { | |
| "text": "or finding the sum of some votes.", | |
| "start": 3772.7, | |
| "duration": 2.49 | |
| }, | |
| { | |
| "text": "And we'll see each of\nthese in action here.", | |
| "start": 3775.19, | |
| "duration": 3.04 | |
| }, | |
| { | |
| "text": "Let's go back to our terminal,\ntry some of these out.", | |
| "start": 3778.23, | |
| "duration": 3.23 | |
| }, | |
| { | |
| "text": "I will try, in this case\nfirst trying to find", | |
| "start": 3781.46, | |
| "duration": 4.26 | |
| }, | |
| { | |
| "text": "the average rating from my longlist.", | |
| "start": 3785.72, | |
| "duration": 2.9 | |
| }, | |
| { | |
| "text": "Well, I just from experience,\nand as you now know too,", | |
| "start": 3788.62, | |
| "duration": 3.43 | |
| }, | |
| { | |
| "text": "I can try to find the\naverage of some column", | |
| "start": 3792.05, | |
| "duration": 2.82 | |
| }, | |
| { | |
| "text": "by using the AVG aggregate function.", | |
| "start": 3794.87, | |
| "duration": 3.52 | |
| }, | |
| { | |
| "text": "So I'll say SELECT not\njust rating in this case", | |
| "start": 3798.39, | |
| "duration": 4.58 | |
| }, | |
| { | |
| "text": "but select the average\nrating FROM \"longlist.\"", | |
| "start": 3802.97, | |
| "duration": 4.95 | |
| }, | |
| { | |
| "text": "Notice how in this case, I'm using this\nkind of syntax, where I take rating,", | |
| "start": 3807.92, | |
| "duration": 5.64 | |
| }, | |
| { | |
| "text": "my column I want to aggregate or\nto sum up or to average like this.", | |
| "start": 3813.56, | |
| "duration": 4.77 | |
| }, | |
| { | |
| "text": "And I apply the function\nby saying its name", | |
| "start": 3818.33, | |
| "duration": 3.18 | |
| }, | |
| { | |
| "text": "followed by some parentheses\naround that column name.", | |
| "start": 3821.51, | |
| "duration": 3.67 | |
| }, | |
| { | |
| "text": "So this will return to\nme not all of the rating", | |
| "start": 3825.18, | |
| "duration": 2.45 | |
| }, | |
| { | |
| "text": "rows but the average of the\nrating rows in one single cell.", | |
| "start": 3827.63, | |
| "duration": 4.8 | |
| }, | |
| { | |
| "text": "Let me try this.", | |
| "start": 3832.43, | |
| "duration": 1.65 | |
| }, | |
| { | |
| "text": "I'll come back, and I\nwill then hit Enter.", | |
| "start": 3834.08, | |
| "duration": 2.91 | |
| }, | |
| { | |
| "text": "And I'll see this is the average rating.", | |
| "start": 3836.99, | |
| "duration": 3.45 | |
| }, | |
| { | |
| "text": "We have 3.7537179471795 is our\naverage rating for all of these books.", | |
| "start": 3840.44, | |
| "duration": 8.28 | |
| }, | |
| { | |
| "text": "But of course, this isn't great.", | |
| "start": 3848.72, | |
| "duration": 3.06 | |
| }, | |
| { | |
| "text": "What might I want to do if I was\ngoing to show this to somebody else?", | |
| "start": 3851.78, | |
| "duration": 4.14 | |
| }, | |
| { | |
| "text": "I could probably improve the\npresentation of this in some way.", | |
| "start": 3855.92, | |
| "duration": 5.02 | |
| }, | |
| { | |
| "text": "So I could probably round\nthis result. I have 3.75371,", | |
| "start": 3860.94, | |
| "duration": 4.7 | |
| }, | |
| { | |
| "text": "we can probably stop after\ntwo decimal points, right?", | |
| "start": 3865.64, | |
| "duration": 2.88 | |
| }, | |
| { | |
| "text": "Just simply like 3.75.", | |
| "start": 3868.52, | |
| "duration": 2.1 | |
| }, | |
| { | |
| "text": "So I could introduce some new keyword\nhere, this one around the results.", | |
| "start": 3870.62, | |
| "duration": 4.71 | |
| }, | |
| { | |
| "text": "Let me show you this one in action.", | |
| "start": 3875.33, | |
| "duration": 2.52 | |
| }, | |
| { | |
| "text": "I'll come back, and I'll try\nnot just select average rating", | |
| "start": 3877.85, | |
| "duration": 3.69 | |
| }, | |
| { | |
| "text": "but select the rounded average rating.", | |
| "start": 3881.54, | |
| "duration": 2.83 | |
| }, | |
| { | |
| "text": "So I'll say SELECT ROUND and then\ntake average of \"rating\" and round", | |
| "start": 3884.37, | |
| "duration": 7.55 | |
| }, | |
| { | |
| "text": "to 2 decimal points FROM\n\"longlist\" Semicolon.", | |
| "start": 3891.92, | |
| "duration": 6.3 | |
| }, | |
| { | |
| "text": "So now this query decides to first\nfind the average of the rating column.", | |
| "start": 3898.22, | |
| "duration": 6.69 | |
| }, | |
| { | |
| "text": "Then take the result and round\nit using two decimal points.", | |
| "start": 3904.91, | |
| "duration": 5.95 | |
| }, | |
| { | |
| "text": "Notice how round takes two inputs\nor two arguments, the first one", | |
| "start": 3910.86, | |
| "duration": 3.65 | |
| }, | |
| { | |
| "text": "being the rating, the average\nrating, the second one being number", | |
| "start": 3914.51, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "of decimal points to round, 2.", | |
| "start": 3918.5, | |
| "duration": 1.8 | |
| }, | |
| { | |
| "text": "And we complete our query in the way we\nusually do by saying FROM this table.", | |
| "start": 3920.3, | |
| "duration": 4.33 | |
| }, | |
| { | |
| "text": "So let's try this one\nto figure this out.", | |
| "start": 3924.63, | |
| "duration": 2.24 | |
| }, | |
| { | |
| "text": "I'll come back.", | |
| "start": 3926.87, | |
| "duration": 0.75 | |
| }, | |
| { | |
| "text": "And I'll hit Enter.", | |
| "start": 3927.62, | |
| "duration": 1.5 | |
| }, | |
| { | |
| "text": "And now I'll see we do get back 3.75.", | |
| "start": 3929.12, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "But there is still one\nthing to improve here.", | |
| "start": 3933.11, | |
| "duration": 2.61 | |
| }, | |
| { | |
| "text": "When I write this query, I\nsee this ugly title name--", | |
| "start": 3935.72, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "ROUND average \"rating\" comma 2.", | |
| "start": 3939.59, | |
| "duration": 2.4 | |
| }, | |
| { | |
| "text": "I wouldn't send this to my\nboss or somebody else who I", | |
| "start": 3941.99, | |
| "duration": 2.785 | |
| }, | |
| { | |
| "text": "work for or maybe even a friend, right?", | |
| "start": 3944.775, | |
| "duration": 1.625 | |
| }, | |
| { | |
| "text": "I want to make sure it's pretty\nso they can read it correctly.", | |
| "start": 3946.4, | |
| "duration": 2.77 | |
| }, | |
| { | |
| "text": "So what could I do then to\ntry to make this prettier?", | |
| "start": 3949.17, | |
| "duration": 4.18 | |
| }, | |
| { | |
| "text": "I could maybe rename this column.", | |
| "start": 3953.35, | |
| "duration": 1.74 | |
| }, | |
| { | |
| "text": "I could try to take this and make\nit not just this ugly mess of SQL", | |
| "start": 3955.09, | |
| "duration": 4.59 | |
| }, | |
| { | |
| "text": "keyword but to give it some\nname I could use instead.", | |
| "start": 3959.68, | |
| "duration": 3.13 | |
| }, | |
| { | |
| "text": "So for this, we'll\nintroduce a brand new one--", | |
| "start": 3962.81, | |
| "duration": 2.36 | |
| }, | |
| { | |
| "text": "new brand new keyword called AS.", | |
| "start": 3965.17, | |
| "duration": 2.13 | |
| }, | |
| { | |
| "text": "Let's try this one too.", | |
| "start": 3967.3, | |
| "duration": 1.8 | |
| }, | |
| { | |
| "text": "I'll come back, and I'll say SELECT,\nagain, ROUND average \"rating\" comma 2.", | |
| "start": 3969.1, | |
| "duration": 10.02 | |
| }, | |
| { | |
| "text": "But now, I'll select it AS,\nlet's say, average rating.", | |
| "start": 3979.12, | |
| "duration": 6.14 | |
| }, | |
| { | |
| "text": "And now before I actually\nfinish this query,", | |
| "start": 3985.26, | |
| "duration": 1.833 | |
| }, | |
| { | |
| "text": "let me try to bring it up to the top\nmy terminal so we can see it all in one", | |
| "start": 3987.093, | |
| "duration": 3.167 | |
| }, | |
| { | |
| "text": "go.", | |
| "start": 3990.26, | |
| "duration": 0.57 | |
| }, | |
| { | |
| "text": "I'll backspace this.", | |
| "start": 3990.83, | |
| "duration": 1.32 | |
| }, | |
| { | |
| "text": "And I'll say SELECT the rounded\nversion of the average rating rounded", | |
| "start": 3992.15, | |
| "duration": 8.3 | |
| }, | |
| { | |
| "text": "to 2 decimal points AS--", | |
| "start": 4000.45, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "let's call this one \"average rating.\"", | |
| "start": 4002.76, | |
| "duration": 2.91 | |
| }, | |
| { | |
| "text": "Now hit Enter.", | |
| "start": 4005.67, | |
| "duration": 1.11 | |
| }, | |
| { | |
| "text": "And I'll say FROM my\n\"longlist\" table Semicolon.", | |
| "start": 4006.78, | |
| "duration": 4.59 | |
| }, | |
| { | |
| "text": "Now, I see it's much prettier overall.", | |
| "start": 4011.37, | |
| "duration": 2.46 | |
| }, | |
| { | |
| "text": "I have no longer these\nSQL keywords but instead", | |
| "start": 4013.83, | |
| "duration": 3.18 | |
| }, | |
| { | |
| "text": "just average rating as my column name.", | |
| "start": 4017.01, | |
| "duration": 4.11 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 4021.12, | |
| "duration": 1.44 | |
| }, | |
| { | |
| "text": "So let me pause here\nand ask questions then", | |
| "start": 4022.56, | |
| "duration": 2.4 | |
| }, | |
| { | |
| "text": "on using average or using ROUND\nor using AS in these cases.", | |
| "start": 4024.96, | |
| "duration": 7.53 | |
| }, | |
| { | |
| "text": "SPEAKER: I'm wondering, do these\nsorts of commands have a funct--", | |
| "start": 4032.49, | |
| "duration": 3.87 | |
| }, | |
| { | |
| "text": "are these commands encode something like\ndata types or just encode something?", | |
| "start": 4036.36, | |
| "duration": 5.4 | |
| }, | |
| { | |
| "text": "Do these commands also have a name?", | |
| "start": 4041.76, | |
| "duration": 2.238 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah.", | |
| "start": 4043.998, | |
| "duration": 0.792 | |
| }, | |
| { | |
| "text": "And can I ask are you referring\nto the AVG like COUNT like SUM", | |
| "start": 4044.79, | |
| "duration": 3.84 | |
| }, | |
| { | |
| "text": "those kinds of things, or?", | |
| "start": 4048.63, | |
| "duration": 1.23 | |
| }, | |
| { | |
| "text": "Yeah.", | |
| "start": 4049.86, | |
| "duration": 0.69 | |
| }, | |
| { | |
| "text": "So these functions do have a name.", | |
| "start": 4050.55, | |
| "duration": 2.59 | |
| }, | |
| { | |
| "text": "They are called aggregate functions.", | |
| "start": 4053.14, | |
| "duration": 1.61 | |
| }, | |
| { | |
| "text": "And aggregate means to\ncombine, to bring together.", | |
| "start": 4054.75, | |
| "duration": 3.1 | |
| }, | |
| { | |
| "text": "So they're called aggregate functions\nbecause they take some number of rows,", | |
| "start": 4057.85, | |
| "duration": 3.56 | |
| }, | |
| { | |
| "text": "like all my ratings for instance,\nand bring it down to one single cell,", | |
| "start": 4061.41, | |
| "duration": 4.2 | |
| }, | |
| { | |
| "text": "like the average or\nthe sum or the count.", | |
| "start": 4065.61, | |
| "duration": 2.92 | |
| }, | |
| { | |
| "text": "So if you look up or read more\nabout SQL aggregate functions,", | |
| "start": 4068.53, | |
| "duration": 3.5 | |
| }, | |
| { | |
| "text": "you'll see all of these\nand perhaps some more", | |
| "start": 4072.03, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "depending on the software you're using.", | |
| "start": 4074.07, | |
| "duration": 3.68 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 4077.75, | |
| "duration": 0.78 | |
| }, | |
| { | |
| "text": "So let's keep going then and try\nto start counting some other rows", | |
| "start": 4078.53, | |
| "duration": 4.44 | |
| }, | |
| { | |
| "text": "and use our other\naggregate functions here.", | |
| "start": 4082.97, | |
| "duration": 1.98 | |
| }, | |
| { | |
| "text": "I'll go back to my terminal.", | |
| "start": 4084.95, | |
| "duration": 1.89 | |
| }, | |
| { | |
| "text": "And so far, we've seen average, as\nwell as we have seen ROUND and so on.", | |
| "start": 4086.84, | |
| "duration": 6.3 | |
| }, | |
| { | |
| "text": "But why don't I try to find the maximum\nor the minimum rating in my table?", | |
| "start": 4093.14, | |
| "duration": 5.46 | |
| }, | |
| { | |
| "text": "I'll say SELECT, let's say, the MAX\n\"rating\" FROM my \"longlist\" Semicolon.", | |
| "start": 4098.6, | |
| "duration": 6.96 | |
| }, | |
| { | |
| "text": "Hit Enter.", | |
| "start": 4105.56, | |
| "duration": 1.11 | |
| }, | |
| { | |
| "text": "Now I see the highest rated\nbook had a rating of 4.52.", | |
| "start": 4106.67, | |
| "duration": 4.859 | |
| }, | |
| { | |
| "text": "Well, what about the minimum rating?", | |
| "start": 4111.529, | |
| "duration": 1.5 | |
| }, | |
| { | |
| "text": "I could use MIN here too.", | |
| "start": 4113.029, | |
| "duration": 1.171 | |
| }, | |
| { | |
| "text": "I could say SELECT, let's say, MIN of\nmy \"rating\" column FROM my \"longlist\"", | |
| "start": 4114.2, | |
| "duration": 6.11 | |
| }, | |
| { | |
| "text": "table.", | |
| "start": 4120.31, | |
| "duration": 0.69 | |
| }, | |
| { | |
| "text": "I'll hit Semicolon.", | |
| "start": 4121.0, | |
| "duration": 1.71 | |
| }, | |
| { | |
| "text": "And I'll see it 3.05.", | |
| "start": 4122.71, | |
| "duration": 1.979 | |
| }, | |
| { | |
| "text": "It is the lowest-rated\nbook I have in this set.", | |
| "start": 4124.689, | |
| "duration": 4.29 | |
| }, | |
| { | |
| "text": "Well, as we've seen, let me\ntry to view this for you all.", | |
| "start": 4128.979, | |
| "duration": 4.05 | |
| }, | |
| { | |
| "text": "I could say SELECT \"title\" and\n\"votes\" FROM my \"longlist.\"", | |
| "start": 4133.029, | |
| "duration": 6.361 | |
| }, | |
| { | |
| "text": "SELECT \"title\" and \"votes\"\nfrom my \"longlist.\"", | |
| "start": 4139.39, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "Here, I have many books with\nmany user-generated votes.", | |
| "start": 4141.43, | |
| "duration": 4.74 | |
| }, | |
| { | |
| "text": "Maybe people on the internet\ndecided to rate this book out of 5", | |
| "start": 4146.17, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "and maybe Go, Went, Gone got\nabout, let's say, 592 votes.", | |
| "start": 4149.74, | |
| "duration": 5.38 | |
| }, | |
| { | |
| "text": "So I'm curious then, how many total\nvotes do I have in my data set?", | |
| "start": 4155.12, | |
| "duration": 5.58 | |
| }, | |
| { | |
| "text": "Well, for that, I could use\nthe SUM aggregate function.", | |
| "start": 4160.7, | |
| "duration": 2.9 | |
| }, | |
| { | |
| "text": "Try to count up each one of these\nrows and/or turn it back to me", | |
| "start": 4163.6, | |
| "duration": 4.259 | |
| }, | |
| { | |
| "text": "in a single cell.", | |
| "start": 4167.859, | |
| "duration": 1.691 | |
| }, | |
| { | |
| "text": "So I'll use SUM here.", | |
| "start": 4169.55, | |
| "duration": 1.429 | |
| }, | |
| { | |
| "text": "I'll come back and I'll say I want\nto find the sum of my votes column.", | |
| "start": 4170.979, | |
| "duration": 5.25 | |
| }, | |
| { | |
| "text": "I'll say SELECT, let's say,\nthe SUM of my \"votes\" column", | |
| "start": 4176.229, | |
| "duration": 6.661 | |
| }, | |
| { | |
| "text": "FROM my \"longlist\" table.", | |
| "start": 4182.89, | |
| "duration": 2.62 | |
| }, | |
| { | |
| "text": "And then I'll just Enter--", | |
| "start": 4185.51, | |
| "duration": 1.219 | |
| }, | |
| { | |
| "text": "Semicolon Enter.", | |
| "start": 4186.729, | |
| "duration": 1.231 | |
| }, | |
| { | |
| "text": "And I'll see over 600,000\npeople offer to vote", | |
| "start": 4187.96, | |
| "duration": 4.71 | |
| }, | |
| { | |
| "text": "for each of these books that were\nlonglisted for the International Booker", | |
| "start": 4192.67, | |
| "duration": 4.14 | |
| }, | |
| { | |
| "text": "Prize.", | |
| "start": 4196.81, | |
| "duration": 1.81 | |
| }, | |
| { | |
| "text": "Now there'd be a few more here.", | |
| "start": 4198.62, | |
| "duration": 1.45 | |
| }, | |
| { | |
| "text": "Let's check out what else we have left\nto do and our aggregate functions.", | |
| "start": 4200.07, | |
| "duration": 3.17 | |
| }, | |
| { | |
| "text": "We could also try to count up just\nthe number of books in our data set.", | |
| "start": 4203.24, | |
| "duration": 4.96 | |
| }, | |
| { | |
| "text": "So why don't I try to find\nthe number of rows I have?", | |
| "start": 4208.2, | |
| "duration": 3.71 | |
| }, | |
| { | |
| "text": "For that, I could use count.", | |
| "start": 4211.91, | |
| "duration": 2.16 | |
| }, | |
| { | |
| "text": "And often to find the number\nof rows in your data set,", | |
| "start": 4214.07, | |
| "duration": 3.03 | |
| }, | |
| { | |
| "text": "you might use count and star\nas we saw a little earlier.", | |
| "start": 4217.1, | |
| "duration": 3.36 | |
| }, | |
| { | |
| "text": "I could say SELECT COUNT\nstar from \"longlist\"", | |
| "start": 4220.46, | |
| "duration": 4.74 | |
| }, | |
| { | |
| "text": "And this means, again star means\ngive me every row and every column.", | |
| "start": 4225.2, | |
| "duration": 5.07 | |
| }, | |
| { | |
| "text": "Give me basically my whole table, right?", | |
| "start": 4230.27, | |
| "duration": 2.58 | |
| }, | |
| { | |
| "text": "And if I say COUNT star, that\nmeans count up the number of rows", | |
| "start": 4232.85, | |
| "duration": 3.9 | |
| }, | |
| { | |
| "text": "that I have in my database.", | |
| "start": 4236.75, | |
| "duration": 2.53 | |
| }, | |
| { | |
| "text": "So I'll say COUNT star from \"longlist.\"", | |
| "start": 4239.28, | |
| "duration": 2.27 | |
| }, | |
| { | |
| "text": "And I get back 78\nbooks in this database.", | |
| "start": 4241.55, | |
| "duration": 4.2 | |
| }, | |
| { | |
| "text": "Well, let me try counting up\nthe number of translators here.", | |
| "start": 4245.75, | |
| "duration": 2.97 | |
| }, | |
| { | |
| "text": "I'll say SELECT, let's say, COUNT\nof \"translators\" FROM \"longlist\"", | |
| "start": 4248.72, | |
| "duration": 6.12 | |
| }, | |
| { | |
| "text": "Semicolon.", | |
| "start": 4254.84, | |
| "duration": 1.05 | |
| }, | |
| { | |
| "text": "Hit Enter.", | |
| "start": 4255.89, | |
| "duration": 1.41 | |
| }, | |
| { | |
| "text": "And now I see 76.", | |
| "start": 4257.3, | |
| "duration": 3.37 | |
| }, | |
| { | |
| "text": "So I have 78 books, but if I count\ntranslators, I have 76 of them.", | |
| "start": 4260.67, | |
| "duration": 8.01 | |
| }, | |
| { | |
| "text": "So why might that be?", | |
| "start": 4268.68, | |
| "duration": 2.19 | |
| }, | |
| { | |
| "text": "Free to raise your hand\nand try to guess at this.", | |
| "start": 4270.87, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "Why do I have 78 rows\nbut 76 translators?", | |
| "start": 4274.08, | |
| "duration": 4.973 | |
| }, | |
| { | |
| "text": "SPEAKER: Hi.", | |
| "start": 4279.053, | |
| "duration": 0.947 | |
| }, | |
| { | |
| "text": "I actually had raised my\nhand for the question.", | |
| "start": 4280.0, | |
| "duration": 2.412 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah, go ahead.", | |
| "start": 4282.412, | |
| "duration": 1.208 | |
| }, | |
| { | |
| "text": "SPEAKER: Also, I wanted\nto know whether the MAX", | |
| "start": 4283.62, | |
| "duration": 2.59 | |
| }, | |
| { | |
| "text": "and the MIN functions can be used for\nfinding the longest or the shortest", | |
| "start": 4286.21, | |
| "duration": 3.81 | |
| }, | |
| { | |
| "text": "string as well?", | |
| "start": 4290.02, | |
| "duration": 0.69 | |
| }, | |
| { | |
| "text": "Or do you have a different\ncommand for that?", | |
| "start": 4290.71, | |
| "duration": 1.833 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Good question.", | |
| "start": 4292.543, | |
| "duration": 1.167 | |
| }, | |
| { | |
| "text": "Could we use MAX and MIN to find\nthe longest or shortest string?", | |
| "start": 4293.71, | |
| "duration": 3.33 | |
| }, | |
| { | |
| "text": "That's a good question.", | |
| "start": 4297.04, | |
| "duration": 1.1 | |
| }, | |
| { | |
| "text": "So let's actually pause on this counting\nhere and try that out real quick.", | |
| "start": 4298.14, | |
| "duration": 3.43 | |
| }, | |
| { | |
| "text": "So I'll come back to my terminal.", | |
| "start": 4301.57, | |
| "duration": 1.87 | |
| }, | |
| { | |
| "text": "And let me try to use MAX and\nMIN with some book titles.", | |
| "start": 4303.44, | |
| "duration": 4.04 | |
| }, | |
| { | |
| "text": "So I'll say Select--", | |
| "start": 4307.48, | |
| "duration": 2.61 | |
| }, | |
| { | |
| "text": "let's select the MAX title.", | |
| "start": 4310.09, | |
| "duration": 2.7 | |
| }, | |
| { | |
| "text": "And at the same time, why don't\nwe select the MIN title as well?", | |
| "start": 4312.79, | |
| "duration": 4.99 | |
| }, | |
| { | |
| "text": "And I'll select these\nfrom my \"longlist\" table.", | |
| "start": 4317.78, | |
| "duration": 3.14 | |
| }, | |
| { | |
| "text": "I'll hit Semicolon.", | |
| "start": 4320.92, | |
| "duration": 1.45 | |
| }, | |
| { | |
| "text": "And now, let me try this out.", | |
| "start": 4322.37, | |
| "duration": 2.74 | |
| }, | |
| { | |
| "text": "I'll get back Wretchedness\nand A New Name--", | |
| "start": 4325.11, | |
| "duration": 3.99 | |
| }, | |
| { | |
| "text": "Septology VI-VII.", | |
| "start": 4329.1, | |
| "duration": 3.47 | |
| }, | |
| { | |
| "text": "Now, there's a few hypotheses here.", | |
| "start": 4332.57, | |
| "duration": 2.37 | |
| }, | |
| { | |
| "text": "It does seem that our MAX \"title\"\nis shorter than our MIN \"title.\"", | |
| "start": 4334.94, | |
| "duration": 4.59 | |
| }, | |
| { | |
| "text": "So it's probably not that MAX\ngives us the length of the string,", | |
| "start": 4339.53, | |
| "duration": 4.33 | |
| }, | |
| { | |
| "text": "but what do you notice?", | |
| "start": 4343.86, | |
| "duration": 1.56 | |
| }, | |
| { | |
| "text": "Well, I see MIN is really\nearly on in the alphabet.", | |
| "start": 4345.42, | |
| "duration": 3.515 | |
| }, | |
| { | |
| "text": "It has an A here, whereas MAX has\na W, pretty low in the alphabet.", | |
| "start": 4348.935, | |
| "duration": 5.355 | |
| }, | |
| { | |
| "text": "And I would bet if we\nordered these book titles,", | |
| "start": 4354.29, | |
| "duration": 3.03 | |
| }, | |
| { | |
| "text": "we would see a new name up at the very\ntop and a Wretchedness, the book here,", | |
| "start": 4357.32, | |
| "duration": 5.82 | |
| }, | |
| { | |
| "text": "down at the bottom.", | |
| "start": 4363.14, | |
| "duration": 1.57 | |
| }, | |
| { | |
| "text": "So MAX seems to give us the\nlowest alphabetically, which", | |
| "start": 4364.71, | |
| "duration": 4.04 | |
| }, | |
| { | |
| "text": "is kind of contradictory\nwith titles here or strings.", | |
| "start": 4368.75, | |
| "duration": 2.88 | |
| }, | |
| { | |
| "text": "And MIN gives us the earliest in\nthe alphabet using this A as well.", | |
| "start": 4371.63, | |
| "duration": 6.56 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 4378.19, | |
| "duration": 0.75 | |
| }, | |
| { | |
| "text": "So a good question.", | |
| "start": 4378.94, | |
| "duration": 0.97 | |
| }, | |
| { | |
| "text": "Let's come back to our counting here.", | |
| "start": 4379.91, | |
| "duration": 1.93 | |
| }, | |
| { | |
| "text": "Let's go back to my terminal.", | |
| "start": 4381.84, | |
| "duration": 1.24 | |
| }, | |
| { | |
| "text": "And again, we had, in this case,\n78 rows, but only 76 translators.", | |
| "start": 4383.08, | |
| "duration": 6.06 | |
| }, | |
| { | |
| "text": "So, again, if I did SELECT\nCOUNT star from, let's say,", | |
| "start": 4389.14, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "\"longlist\" then\nSemicolon, I get back 78.", | |
| "start": 4392.71, | |
| "duration": 4.29 | |
| }, | |
| { | |
| "text": "But if I do SELECT COUNT of \"translator\"\nfrom \"longlist,\" I get back 76.", | |
| "start": 4397.0, | |
| "duration": 8.28 | |
| }, | |
| { | |
| "text": "And let me ask again, why do we\nhave 78 rows but 76 translators?", | |
| "start": 4405.28, | |
| "duration": 6.36 | |
| }, | |
| { | |
| "text": "Feel free to say it.", | |
| "start": 4411.64, | |
| "duration": 2.495 | |
| }, | |
| { | |
| "text": "OK, so I'm seeing maybe we\nhave some number of rows, 78.", | |
| "start": 4414.135, | |
| "duration": 5.215 | |
| }, | |
| { | |
| "text": "But for our translators, you remember,\ntwo of those were null values.", | |
| "start": 4419.35, | |
| "duration": 4.5 | |
| }, | |
| { | |
| "text": "They didn't exist in our table.", | |
| "start": 4423.85, | |
| "duration": 1.96 | |
| }, | |
| { | |
| "text": "So it seems like if we use COUNT\nstar, we're counting all the rows.", | |
| "start": 4425.81, | |
| "duration": 4.83 | |
| }, | |
| { | |
| "text": "But if we use COUNT \"translator,\"\nsome column that has null values,", | |
| "start": 4430.64, | |
| "duration": 4.07 | |
| }, | |
| { | |
| "text": "we're only getting back those rows\nor those values that aren't null.", | |
| "start": 4434.71, | |
| "duration": 4.3 | |
| }, | |
| { | |
| "text": "So COUNT, when given a\ncolumn, counts only those that", | |
| "start": 4439.01, | |
| "duration": 3.05 | |
| }, | |
| { | |
| "text": "are not null that exist in our table.", | |
| "start": 4442.06, | |
| "duration": 4.56 | |
| }, | |
| { | |
| "text": "OK, let's look at one more\nexample here for counting.", | |
| "start": 4446.62, | |
| "duration": 2.62 | |
| }, | |
| { | |
| "text": "And let's try this.", | |
| "start": 4449.24, | |
| "duration": 2.74 | |
| }, | |
| { | |
| "text": "Let's say I want to find all of\nthe publishers in this database.", | |
| "start": 4451.98, | |
| "duration": 4.1 | |
| }, | |
| { | |
| "text": "I'll say SELECT COUNT of\n\"publisher\" from my \"longlist.\"", | |
| "start": 4456.08, | |
| "duration": 6.15 | |
| }, | |
| { | |
| "text": "And I'll hit Semicolon.", | |
| "start": 4462.23, | |
| "duration": 2.16 | |
| }, | |
| { | |
| "text": "So you might think that I have\n78 publishers in this long list.", | |
| "start": 4464.39, | |
| "duration": 5.94 | |
| }, | |
| { | |
| "text": "But would it be accurate\nif I were to say", | |
| "start": 4470.33, | |
| "duration": 1.86 | |
| }, | |
| { | |
| "text": "I have 78 different\npublishers in this longlist?", | |
| "start": 4472.19, | |
| "duration": 4.97 | |
| }, | |
| { | |
| "text": "Could I say that?", | |
| "start": 4477.16, | |
| "duration": 2.92 | |
| }, | |
| { | |
| "text": "I'm seeing no, right?", | |
| "start": 4480.08, | |
| "duration": 1.47 | |
| }, | |
| { | |
| "text": "I couldn't try to count\nup these publishers", | |
| "start": 4481.55, | |
| "duration": 2.73 | |
| }, | |
| { | |
| "text": "and then say I have 78 different ones.", | |
| "start": 4484.28, | |
| "duration": 1.98 | |
| }, | |
| { | |
| "text": "I might double count the\npublisher along the way.", | |
| "start": 4486.26, | |
| "duration": 3.12 | |
| }, | |
| { | |
| "text": "And let me show you what we mean here.", | |
| "start": 4489.38, | |
| "duration": 1.72 | |
| }, | |
| { | |
| "text": "So I'll go back to my table.", | |
| "start": 4491.1, | |
| "duration": 1.58 | |
| }, | |
| { | |
| "text": "And let me try to select from publishers\nor select the publisher column", | |
| "start": 4492.68, | |
| "duration": 4.68 | |
| }, | |
| { | |
| "text": "from longlist.", | |
| "start": 4497.36, | |
| "duration": 1.17 | |
| }, | |
| { | |
| "text": "I'll select \"publisher\" from \"longlist.\"", | |
| "start": 4498.53, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "Hit Semicolon.", | |
| "start": 4502.1, | |
| "duration": 1.77 | |
| }, | |
| { | |
| "text": "Oops, and now I see\nsomething a little odd.", | |
| "start": 4503.87, | |
| "duration": 2.82 | |
| }, | |
| { | |
| "text": "Let me scroll back up and maybe\nask for a raised hand here.", | |
| "start": 4506.69, | |
| "duration": 6.38 | |
| }, | |
| { | |
| "text": "Why might I get this odd result?", | |
| "start": 4513.07, | |
| "duration": 6.49 | |
| }, | |
| { | |
| "text": "SPEAKER: Because of the quotes?", | |
| "start": 4519.56, | |
| "duration": 1.758 | |
| }, | |
| { | |
| "text": "CARTER ZENKE: Yeah.", | |
| "start": 4521.318, | |
| "duration": 0.792 | |
| }, | |
| { | |
| "text": "So I think I mistyped\nsome of my query here.", | |
| "start": 4522.11, | |
| "duration": 2.25 | |
| }, | |
| { | |
| "text": "I said it looks like \"pubsliher\"\ninstead of \"publisher.\"", | |
| "start": 4524.36, | |
| "duration": 4.29 | |
| }, | |
| { | |
| "text": "And in this case, SQL will\ngive me what I asked for.", | |
| "start": 4528.65, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "I said SELECT \"pubsliher\"\nfrom \"longlist.\"", | |
| "start": 4531.86, | |
| "duration": 2.54 | |
| }, | |
| { | |
| "text": "And says, OK, here it is.", | |
| "start": 4534.4, | |
| "duration": 1.36 | |
| }, | |
| { | |
| "text": "But that column doesn't exist\nso it creates this data for me.", | |
| "start": 4535.76, | |
| "duration": 3.07 | |
| }, | |
| { | |
| "text": "So let me try this again.", | |
| "start": 4538.83, | |
| "duration": 2.03 | |
| }, | |
| { | |
| "text": "I'll go back.", | |
| "start": 4540.86, | |
| "duration": 0.66 | |
| }, | |
| { | |
| "text": "And I'll hopefully type\nthis correctly now.", | |
| "start": 4541.52, | |
| "duration": 1.95 | |
| }, | |
| { | |
| "text": "I'll say SELECT, let's say, \"publisher,\"\nthis one, FROM \"longlist\" Semicolon.", | |
| "start": 4543.47, | |
| "duration": 8.89 | |
| }, | |
| { | |
| "text": "And now I'll see all of the\npublishers that I have in my table.", | |
| "start": 4552.36, | |
| "duration": 4.91 | |
| }, | |
| { | |
| "text": "But what do you see?", | |
| "start": 4557.27, | |
| "duration": 0.848 | |
| }, | |
| { | |
| "text": "Well, some repeat, right?", | |
| "start": 4558.118, | |
| "duration": 1.042 | |
| }, | |
| { | |
| "text": "I have Harvill Secker\nmultiple times here.", | |
| "start": 4559.16, | |
| "duration": 3.18 | |
| }, | |
| { | |
| "text": "I have similarly MacLehose\nPress multiple times as well.", | |
| "start": 4562.34, | |
| "duration": 3.67 | |
| }, | |
| { | |
| "text": "So if I count it up,\nthese publishers, I would", | |
| "start": 4566.01, | |
| "duration": 3.11 | |
| }, | |
| { | |
| "text": "get each one counted one\ntime, which I want to find", | |
| "start": 4569.12, | |
| "duration": 3.6 | |
| }, | |
| { | |
| "text": "the distinct ones the different ones.", | |
| "start": 4572.72, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "I need a new keyword for this.", | |
| "start": 4574.76, | |
| "duration": 2.04 | |
| }, | |
| { | |
| "text": "And for this, we'll use this keyword\nindeed called DISTINCT, trying", | |
| "start": 4576.8, | |
| "duration": 3.39 | |
| }, | |
| { | |
| "text": "to find unique values from our column.", | |
| "start": 4580.19, | |
| "duration": 3.46 | |
| }, | |
| { | |
| "text": "So let's try this.", | |
| "start": 4583.65, | |
| "duration": 1.31 | |
| }, | |
| { | |
| "text": "I'll go back over here and I will\nnow select not just publishers,", | |
| "start": 4584.96, | |
| "duration": 5.4 | |
| }, | |
| { | |
| "text": "but distinct publishers.", | |
| "start": 4590.36, | |
| "duration": 1.71 | |
| }, | |
| { | |
| "text": "I'll say SELECT DISTINCT publisher\nfrom \"longlist\" Semicolon.", | |
| "start": 4592.07, | |
| "duration": 7.75 | |
| }, | |
| { | |
| "text": "Now, if I scroll through here, I\nshould see each publisher in here", | |
| "start": 4599.82, | |
| "duration": 5.1 | |
| }, | |
| { | |
| "text": "only one time.", | |
| "start": 4604.92, | |
| "duration": 1.83 | |
| }, | |
| { | |
| "text": "If they have the same name,\nthey've been filtered out.", | |
| "start": 4606.75, | |
| "duration": 2.58 | |
| }, | |
| { | |
| "text": "And now they're only the\nsame publisher here too.", | |
| "start": 4609.33, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "So I will then try to\nsay SELECT, let's say,", | |
| "start": 4612.54, | |
| "duration": 2.31 | |
| }, | |
| { | |
| "text": "COUNT of \"publisher,\" SELECT\nCOUNT of \"publisher\" from--", | |
| "start": 4614.85, | |
| "duration": 6.167 | |
| }, | |
| { | |
| "text": "COUNT of DISTINCT\n\"publisher,\" for instance.", | |
| "start": 4621.017, | |
| "duration": 1.833 | |
| }, | |
| { | |
| "text": "COUNT distinct publisher-- oh, typo,\n\"publisher\" FROM \"longlist\" Semicolon.", | |
| "start": 4622.85, | |
| "duration": 12.29 | |
| }, | |
| { | |
| "text": "And I'll see I have 33\ndistinct publishers.", | |
| "start": 4635.14, | |
| "duration": 4.56 | |
| }, | |
| { | |
| "text": "OK.", | |
| "start": 4639.7, | |
| "duration": 1.35 | |
| }, | |
| { | |
| "text": "So this just about brings\nus to the conclusion", | |
| "start": 4641.05, | |
| "duration": 3.57 | |
| }, | |
| { | |
| "text": "of all of these new SQL keywords here.", | |
| "start": 4644.62, | |
| "duration": 2.46 | |
| }, | |
| { | |
| "text": "We've seen so far that we\nhave several here to use.", | |
| "start": 4647.08, | |
| "duration": 3.48 | |
| }, | |
| { | |
| "text": "But let's figure out how to\nactually exit this prompt.", | |
| "start": 4650.56, | |
| "duration": 2.615 | |
| }, | |
| { | |
| "text": "So you might it be in your\nSQLite prompt right now.", | |
| "start": 4653.175, | |
| "duration": 2.125 | |
| }, | |
| { | |
| "text": "If you want to leave it, you could\nalso use this command, dot quit.", | |
| "start": 4655.3, | |
| "duration": 4.56 | |
| }, | |
| { | |
| "text": "Dot quit is not a SQL keyword.", | |
| "start": 4659.86, | |
| "duration": 1.68 | |
| }, | |
| { | |
| "text": "It's a SQLite keyword\nto leave your terminal", | |
| "start": 4661.54, | |
| "duration": 2.7 | |
| }, | |
| { | |
| "text": "and go back to where you started.", | |
| "start": 4664.24, | |
| "duration": 2.98 | |
| }, | |
| { | |
| "text": "So just to review then,\nwhat we've seen so far", | |
| "start": 4667.22, | |
| "duration": 3.59 | |
| }, | |
| { | |
| "text": "is how to select data from our table.", | |
| "start": 4670.81, | |
| "duration": 2.55 | |
| }, | |
| { | |
| "text": "We can use select column to\ntake some column from our table", | |
| "start": 4673.36, | |
| "duration": 3.51 | |
| }, | |
| { | |
| "text": "and give us back all of those rows\nfrom that table for that column.", | |
| "start": 4676.87, | |
| "duration": 5.19 | |
| }, | |
| { | |
| "text": "We've seen we can apply some\naggregate functions to take", | |
| "start": 4682.06, | |
| "duration": 3.06 | |
| }, | |
| { | |
| "text": "maybe the count of our columns\nor the average or so on.", | |
| "start": 4685.12, | |
| "duration": 3.19 | |
| }, | |
| { | |
| "text": "And we can get back not\njust all of our rows,", | |
| "start": 4688.31, | |
| "duration": 2.55 | |
| }, | |
| { | |
| "text": "but only some of them using our WHERE\nclause here along with a condition.", | |
| "start": 4690.86, | |
| "duration": 5.37 | |
| }, | |
| { | |
| "text": "We could have multiple conditions,\nhaving not just one but perhaps two.", | |
| "start": 4696.23, | |
| "duration": 4.04 | |
| }, | |
| { | |
| "text": "Like, let's say, here,\ncondition 0 and condition 1.", | |
| "start": 4700.27, | |
| "duration": 3.21 | |
| }, | |
| { | |
| "text": "And we could also use, we saw\nbefore, this idea of equals and LIKE", | |
| "start": 4703.48, | |
| "duration": 3.63 | |
| }, | |
| { | |
| "text": "to match some pattern or to make\nsomething exactly equal over here.", | |
| "start": 4707.11, | |
| "duration": 3.9 | |
| }, | |
| { | |
| "text": "We could, again, use AND and OR.", | |
| "start": 4711.01, | |
| "duration": 2.19 | |
| }, | |
| { | |
| "text": "And we saw later on how\nwe could order our data", | |
| "start": 4713.2, | |
| "duration": 2.67 | |
| }, | |
| { | |
| "text": "and use our LIMIT function to get\nback only some number of rows.", | |
| "start": 4715.87, | |
| "duration": 6.07 | |
| }, | |
| { | |
| "text": "Now, this then is our\ninteraction to querying.", | |
| "start": 4721.94, | |
| "duration": 3.59 | |
| }, | |
| { | |
| "text": "And so far, we've seen\nthis world of books.", | |
| "start": 4725.53, | |
| "duration": 3.3 | |
| }, | |
| { | |
| "text": "And the table we've had so far\nreally just has books inside of it.", | |
| "start": 4728.83, | |
| "duration": 3.48 | |
| }, | |
| { | |
| "text": "But next time, what we'll see is how\nto take this world of books and split", | |
| "start": 4732.31, | |
| "duration": 4.71 | |
| }, | |
| { | |
| "text": "into multiple tables.", | |
| "start": 4737.02, | |
| "duration": 1.24 | |
| }, | |
| { | |
| "text": "How do we find information on\npublishers or books or authors too?", | |
| "start": 4738.26, | |
| "duration": 3.995 | |
| }, | |
| { | |
| "text": "And how do we try to\nput that in a table that", | |
| "start": 4742.255, | |
| "duration": 1.875 | |
| }, | |
| { | |
| "text": "can present the relationships among\nall of these different entities?", | |
| "start": 4744.13, | |
| "duration": 3.25 | |
| }, | |
| { | |
| "text": "We'll talk about all that and\nmore when we come back next time.", | |
| "start": 4747.38, | |
| "duration": 2.625 | |
| }, | |
| { | |
| "text": "And we'll see you there.", | |
| "start": 4750.005, | |
| "duration": 1.915 | |
| } | |
| ] |