Running and executing code
1. Running and executing SQL & code cells
Welcome back! In this video we'll discuss SQL and Code cells! Let's learn about these two main types of cells and how they work together to execute our commands and queries.2. SQL and Code cells
There are two main types of cells for interacting with data: SQL cells and Code cells. SQL cells are for running database queries, where you can utilize the Structured Query Language to extract and transform data, while Code cells handle logic written in Python or R. Use these to manipulate data and carry out more complex actions. We can mix and match these cells to analyze data and solve problems efficiently.3. Choosing a coding language
In this course, we’ll use Python for our code cell examples. If we want to use R we can change the language of our notebook using the Environment tab.4. Executing cells
Imagine a notebook as a step-by-step cooking recipe. Each cell is like an individual step: first, we prepare ingredients, then we mix them, and finally, we cook them.5. Executing cells
Similarly, cells in a notebook are executed one at a time, starting from the top. Each step builds on the results of the previous one, so we can use the output of one cell in the next. This helps ensure a smooth workflow, just like following a recipe!6. Executing cells example
Now let's look at how this works in practice. In the first cell, we define a variable containing some text. We then run the next cell, which references that variable to perform a calculation. If we skip a step or run cells out of order, we might get an error or incorrect results. Running cells in the right sequence ensures everything works as expected.7. Monitoring execution
When we run a cell, we’ll notice indicators that show its status. These include whether the cell is running, queued, or has completed. This helps us keep track of the execution flow and ensures the correct order of operations.8. Key takeaways
In this lesson, you learned about SQL and Code cells, how the order they run is important, building on the output of each other. We also saw how to run and monitor them, and how they work together in a notebook environment.9. Let's practice!
Let's practice.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.