Lesson 4 Flashcards

LIMIT & TOP (6 cards)

1
Q

In the real world, tables can have ____ of rows which can take a long time to process… and be very expensive!

_______________________________________________________________

  • Many of the new cloud platforms (like Snowflake and other data warehouses) ____
A

In the real world, tables can have millions of rows which can take a long time to process… and be very expensive!

_______________________________________________________________

  • Many of the new cloud platforms (like Snowflake and other data warehouses) bill based on usage (either on the amount of data pulled or computation time)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

____ when possible for better optimization – especially when you’re just exploring your data!

A

Limit rows and columns when possible for better optimization – especially when you’re just exploring your data!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why (and when) would you want to reduce the rows of your output?

(More than 1 answer)

A
  • Faster
  • Likely less expensive
    _________________________________________________

If you’re brand new to a table, can help you get a sense of:

  • What does this table look like?
  • What kind of data (data types) does it have?
  • What columns does it have?
  • Helps you get a sneak preview of the table / get an overall feel for your data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can we reduce the rows of our output and get a sneak peek of our data?
______________________________________________

For example, how can you pull all the columns (but only 100 rows) from the orders table?

A

Can add LIMIT to the end of any query and follow with how many rows you want in the output:

SELECT
    *
FROM
    orders
LIMIT
    100
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Caution:
You can / can NOT make assumptions on results using a limited output

A

You can NOT make assumptions on results using a limited output

  • This is just a little sample of our data – we can’t make assumptions without performing additional analytics on the entire column/table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If your SQL dialect/platform doesn’t support LIMIT (but most new ones should), try using ___ instead

A

TOP

  • Can always Google/ChatGPT/Gemini etc. to figure out syntax issues
How well did you know this?
1
Not at all
2
3
4
5
Perfectly