## Introduction
Welcome to Lesson 2.3: SQL Basics. This lesson is part of Module 2: Core Skills - Working with Databases in the Database Administration for Developers course. In this lesson, we'll explore the fundamentals of SQL, including its basic structure and how to write simple SELECT statements to retrieve data from relational databases. By the end of this lesson, you will be able to write basic SQL queries to effectively extract information relevant to your work in the finance and fintech sectors.
## Main Content
### Introduction to SQL
SQL, or Structured Query Language, is the standard language for managing and manipulating relational databases. It enables users to perform various operations, such as querying data, updating records, and creating database structures. SQL is essential for anyone working with data, especially in industries like finance and fintech, where data-driven decisions are crucial.
Relational databases, which organize data into tables, are the backbone of many applications. Each table consists of rows (records) and columns (attributes), allowing for efficient data storage and retrieval. SQL provides a consistent way to interact with these databases, making it easier to extract insights.
### Basic Query Structure
At the heart of SQL is the concept of a query, which is a request for data from a database. The basic structure of an SQL query follows this simple format:
```sql
SELECT column1, column2, ...
FROM table_name
WHERE condition;
```
- **SELECT**: This keyword specifies which columns you want to retrieve from the database.
- **FROM**: This keyword indicates the table from which to pull the data.
- **WHERE**: This optional clause filters the results based on specific criteria, ensuring that you only get the data you need.
Let’s break down each component a little further to enhance your understanding.
1. **SELECT Clause**: Here, you can specify one or more columns you want to retrieve. For example, if you have a table called `Customers` with columns like `CustomerID`, `FirstName`, and `LastName`, you can write:
 ```sql
 SELECT FirstName, LastName
 FROM Customers;
 ```
2. **FROM Clause**: This part tells SQL which table to query. It’s essential to know the exact name of the table you’re working with in your database.
3. **WHERE Clause**: This clause allows you to filter results based on specific conditions. For instance, if you only want to see customers from a particular city, you could use:
 ```sql
 SELECT FirstName, LastName
 FROM Customers
 WHERE City = 'New York';
 ```
This query retrieves the first and last names of customers who reside in New York.
### Writing Simple SELECT Statements
Now that we understand the structure, let’s focus on writing simple SELECT statements. These statements allow you to retrieve specific data based on your requirements.
Here are some examples relevant to the finance and fintech context. Imagine you have a database with a table called `Transactions` that records customer transactions, including columns like `TransactionID`, `Amount`, `Date`, and `CustomerID`.
1. **Retrieve All Transactions**: To get all the transactions, you would write:
 ```sql
 SELECT *
 FROM Transactions;
 ```
 The asterisk (*) selects all columns from the table. This can be useful when you need a comprehensive view of the data.
2. **Filter Transactions by Amount**: If you want to see transactions greater than $100, you can use:
 ```sql
 SELECT *
 FROM Transactions
 WHERE Amount > 100;
 ```
 This query will display all transactions where the amount exceeds $100, helping you identify significant transactions.
3. **Select Specific Columns**: If you’re only interested in the transaction amounts and dates, the query would look like this:
 ```sql
 SELECT Amount, Date
 FROM Transactions;
 ```
 This way, you can focus on relevant information without being overwhelmed by unnecessary data.
4. **Combining Conditions**: You can also combine multiple conditions using the `AND` operator. For example, if you want to see transactions over $100 that occurred after January 1, 2023, you could write:
 ```sql
 SELECT *
 FROM Transactions
 WHERE Amount > 100 AND Date > '2023-01-01';
 ```
 This query retrieves all transactions that meet both conditions, allowing for more precise data analysis.
Using these basic constructs, you can start to build more complex queries as you become more comfortable with SQL. Remember, the key is to practice writing these queries, as familiarity will enhance your ability to extract valuable insights from your data.
## Conclusion
In this lesson, we covered the basics of SQL, including its structure and how to write simple SELECT statements. You learned how to retrieve data from relational databases effectively, which is essential for making informed decisions in the finance and fintech industries. Mastering these foundational skills will serve you well as you progress in your data management journey.
## Reflection Questions
1. How would you write a SQL query to find all customers who have made transactions over a certain amount?
2. What might be a practical use case for filtering data with the WHERE clause in a finance-related scenario?
3. Reflect on how understanding SQL could benefit your role in the finance or fintech industry.