Skip to content
Course Notes: Introduction to SQL Server
  • AI Chat
  • Code
  • Report
  • Course Notes

    Use this workspace to take notes, store sample queries, and build your own interactive cheat sheet!

    You will need to connect your SQL cells to an integration to run a query.

    • You can use a sample integration from the dropdown menu. This includes the Course Databases integration, which contains tables you used in our SQL courses.
    • You can connect your own integration by following the instructions provided here.

    Note: When using sample integrations such as those that contain course data, you have read-only access. You can run queries, but cannot make any changes such as adding, deleting, or modifying the data (e.g., creating tables, views, etc.).

    Take Notes

    Add notes here about the concepts you've learned and SQL cells with code you want to keep.

    Add your notes here

    Unknown integration
    Queryavailable as
    query
    variable
    -- A sample query for you to replace!
    SELECT 
        *
    FROM books

    Will this save?

    WHERE clause doesn't work when applying on an aggregate value. Instead we must use HAVING

    Unknown integration
    DataFrameavailable as
    df
    variable
    SELECT 
    	title, year
    FROM
    	books
    WHERE year > 2014
    GROUP BY
    	year, title;
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

    The code below does the same thing using HAVING

    Unknown integration
    DataFrameavailable as
    df1
    variable
    SELECT title, year
    FROM books
    GROUP BY title, year
    HAVING year > 2014;
    
    This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

    When you want to use GROUP by, you must use HAVING when wanting to use certain criterion