Opening
🤔 What Do You Think?

- Colorful spreadsheet-like grid filled with rows and columns of numbers and words on a computer screen
Slide 1
What Is SQL and a Relational Database?
- SQL (Structured Query Language) is a special language used to talk to databases and get information.
- A relational database stores data in tables, which look like spreadsheets with rows and columns.
- Each table has columns named for the type of data, and rows that hold individual records or entries.
- SQL
- — A language to get data from databases.
- relational database
- — A collection of tables with related data.
- row
- — One record or entry in a table.
Check for understanding
Check Your Understanding
Slide 2
Using SELECT to Get Data from a Table
- The SQL SELECT statement asks the database to show specific columns or all columns from a table.
- You can write SELECT * FROM table_name; to get every column for all rows, like asking for the whole spreadsheet.
- Example: SELECT Name, Age FROM Students; shows only the Name and Age columns from the Students table.
- SELECT statement
- — SQL command to choose columns from a table.
- SELECT *
- — Shortcut to get all columns from a table.
- table
- — A set of data organized in rows and columns.
Check for understanding
Check Your Understanding
Slide 3
Understanding Tables, Columns, and Rows
- Columns in a table describe the type of information, like 'Name' or 'Grade', and are the same for every row.
- Rows hold the actual data for one item or person, such as a student named 'Alex' with grade '5'.
- Think of a table like an Excel sheet where columns are categories and rows are individual records.
- column
- — A vertical set of data describing one attribute.
- row
- — A horizontal record containing data for one item.
Check for understanding
Check Your Understanding
Slide 4
Writing a SELECT Query for Specific Columns
- To get only certain columns, write SELECT with the column names separated by commas, like SELECT Name, Grade FROM Students;
- This query returns just the Name and Grade columns for every student row in the Students table.
- Example code: SELECT Name, Age FROM Students; Output: a table showing columns Name and Age with data for each row.
- query
- — A request for information from a database.
Check for understanding
Check Your Understanding
Slide 5
Using SELECT * to Retrieve All Columns
- Using SELECT * means 'select all columns' from the table, so you get every piece of data in each row.
- For example, SELECT * FROM Students; returns all columns like Name, Age, Grade, and more for every student.
- This is useful when you need all information but can be slower if the table has many columns.
- SELECT *
- — Shortcut to get all columns from a table.
Check for understanding
Check Your Understanding
Check for understanding
Solo Run: SQL Queries and Tables
Exit check