1. Home
  2. Explore
  3. Computer Science
  4. SQL for Data Analysis

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

SQL for Data Analysis

  • 35Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: SQL Basics
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What does SQL stand for and what is it used for?

Tap to flipClick to flipspace

Structured Query Language; a language for interacting with databases to retrieve, filter, sort, add, update, and remove data.

Or swipe the card

35 cards

  1. What does SQL stand for and what is it used for?

    Structured Query Language; a language for interacting with databases to retrieve, filter, sort, add, update, and remove data.

  2. What is a database?

    A collection of related tables that store data, often with relationships between them.

  3. What does RDBMS stand for?

    Relational Database Management System.

  4. What is the difference between the SQL Server Express and Developer editions?

    Express: free for business use, limited to 10 GB database size and 4 cores. Developer: full functionality but for development/testing only, not for production use.

  5. How do you verify that SQL Server is running after installation?

    Open SQL Server Configuration Manager (Start > All Apps > Microsoft SQL Server 2019 > Configuration Manager) and check the service status (running, start mode automatic).

  6. What is SQL Server Management Studio (SSMS) and its purpose?

    A graphical tool that provides an interface to connect to SQL Server instances and write queries, manage databases, and view results.

  7. How do you connect to a SQL Server instance in SSMS?

    In the 'Connect to Server' dialog, provide the server name (your PC name, found via 'Browse for more' > 'Database Engine'), choose Windows Authentication, and click Connect.

  8. How do you restore a database backup in SSMS?

    Right-click 'Databases' in Object Explorer > 'Restore Database...' > select 'Device' > browse to the .bak file > OK.

  9. What are tables, fields, and records in a database?

    Tables: database objects that store data in rows and columns. Fields: columns representing attributes. Records: rows representing individual entries.

  10. What is a primary key?

    The minimum number of columns that uniquely identify a row in a table, often an ID column.

  11. What is normalization in databases?

    Designing tables to minimize data repetition by breaking data into separate related tables, reducing redundancy and improving efficiency.

  12. What is a schema in SQL Server?

    A container for database objects (like tables) that groups them logically and can be used to manage access permissions.

  13. What is the purpose of the SELECT statement?

    To retrieve data from one or more tables in a database.

  14. How do you specify which database to query?

    Use a three-part naming convention: DatabaseName.SchemaName.TableName (e.g., KCC.dbo.customers). Alternatively, select the database from the dropdown in SSMS.

  15. What does the DISTINCT keyword do?

    Removes duplicate rows from the result set, returning only unique values for the selected columns.

  16. How do you rename a column in the result set using an alias?

    Use the AS keyword followed by the desired name, e.g., SELECT customer_name AS [Customer Name] FROM customers;

  17. What does the TOP clause do in SQL?

    Limits the number of rows returned in the result set to a specified count (e.g., SELECT TOP 3 * FROM customers; returns the first 3 rows).

  18. How do you filter rows using the WHERE clause?

    Specify conditions after WHERE, e.g., SELECT * FROM customers WHERE state = 'Washington';

  19. What operators can be used with WHERE to combine conditions?

    AND (both conditions true), OR (at least one true), parentheses for grouping logic.

  20. How does the LIKE operator work with the % wildcard?

    LIKE matches patterns. % represents any sequence of characters. 'A%' matches strings starting with 'A', '%A%' matches any string containing 'A'.

  21. How do you sort query results?

    Use ORDER BY column_name ASC (ascending, default) or DESC (descending).

  22. What is the purpose of comments in SQL?

    To explain code or temporarily disable parts. Two dashes (--) for single-line comments; /* ... */ for multi-line comments.

  23. What is a JOIN and why is it used?

    A JOIN combines rows from two or more tables based on a related column (e.g., primary key/foreign key relationship).

  24. What is an INNER JOIN?

    Returns only rows where there is a match in both tables; no NULLs for unmatched rows.

  25. What is a LEFT OUTER JOIN?

    Returns all rows from the left table, and matching rows from the right table; if no match, right table columns are NULL.

  26. What is a RIGHT OUTER JOIN?

    Returns all rows from the right table, and matching rows from the left table; if no match, left table columns are NULL.

  27. How do you handle ambiguous column names in a JOIN?

    Prefix the column with the table name or alias (e.g., customers.CustomerID or c.CustomerID).

  28. What is the purpose of table aliases?

    Shorthand names for tables, making queries shorter and easier to read (e.g., FROM orders AS o JOIN customers AS c ON o.CustomerID = c.CustomerID).

  29. How do you use the GETDATE() function?

    Returns the current system date and time. Often used in comparisons, e.g., WHERE order_date >= DATEADD(month, -1, GETDATE()).

  30. What does DATEADD(interval, number, date) do?

    Adds a specified number of intervals (e.g., months, days) to a date and returns the new date.

  31. How do you count rows in a result set?

    Use COUNT(*) or COUNT(column) to return the number of rows. COUNT(*) counts all rows including NULLs; COUNT(column) counts non-NULL values.

  32. How do you sum numeric column values?

    Use SUM(column_name) to get the total of all values in that column.

  33. What does GROUP BY do?

    Groups rows that have the same values in specified columns into summary rows, often used with aggregate functions (COUNT, SUM, AVG, etc.).

  34. What is the Query Designer in SSMS?

    A visual tool that automatically generates SQL queries by allowing you to select tables, columns, filters, sorts, and groups via a drag-and-drop interface.

  35. How do you add a filter condition in the Query Designer?

    In the grid, under the 'Filter' column for the desired field, type the condition (e.g., >= '2/18/2022'). The tool adds a WHERE clause automatically.

Card 1 of 35
Card 1 of 35

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent